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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!