Can any one explain what we are doing with method computeDiscount in class BuyNItemsGetOneFree ,and CombinedDiscount ,,,?

hello ,Can any one explain what we are doing with method computeDiscount in class BuyNItemsGetOneFree ,and CombinedDiscount ,,,?
Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item. The method has two parameters, numOfItems and itemCost. • Derive a class BulkDiscount from DiscountPolicy. It should have a constructor that has two parameters, minimum and percent. It should define the method computeDiscount so that if the quantity purchased of an item is more than minimum, the discount is the same as the percent. • Derive a class BuyNItemsGetOneFree from DiscountPolicy. The class should have a constructor that has a single parameter n. In addition, the class should define the method computeDiscount so that every nth item is free. For example, the following table gives the discount for the purchase of various numOfItems that costs $10, when n is 3: numOfItems 1 2 3 4 5 6 7 Discount 0 0 10 10 10 20 20 Hint: numOfItems has to be greater than the n in order to get a discount every time nth item is bought. • Derive a class CombinedDiscount from DiscountPolicy. It should have a constructor that has two parameters of type DiscountPolicy. It should define the method computeDiscount to return the maximum value returned by computeDiscount for each of its two private discount policies. • Finally, Write a program to test your classes. In the main create an array of DiscountPolicy and add 3 objects of type BulkDiscount, BuyNItemsGetOneFree, and CombinedDiscount, respectively. After that, call the method computeDiscount for each object. • Draw a UML diagram for this problem. Note: • All inputs should be read from the user. • You may add any necessary attribute(s)/method(s).

Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount

Posted in Uncategorized