Question: Java programming: Create a program that : a.use an abstract class DicountPolicy that compute discount and return the discount for the purpose of a given
Java programming:
Create a program that :
a.use an abstract class DicountPolicy that compute discount and return the discount for the purpose of a given number of a single item.DiscountPolicy (count,itemCost)
b.derive a class BulkDiscount from DiscountPolicy. DiscountPolicy(minimum,percent)
c. it should define the method computeDiscount (if the quantity purchased of an item > minimum, the deiscount is percent percent.
d. derive a class BuyNItemsGetFree from DiscountPolicy (BuyNItemGtFree(n)).
It should define the method computeDiscount so that every nth item is free.Example:
Count 1 2 3 4 5 6 7
discount 0 0 10 10 10 20 20
e. define class CombinedDiscount from DiscountPolicy
(CombineDiscount(DiscountPolicy p1, DiscountPolicy p2)
It should define the method computeDicount to return the maximum value returned by computeDiscount for each of its two private discount policies
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
