Question: java a) Create an abstract class Discount Policy. It should have a singie abstract method comp uteDiscount that will return the discount from the purchase

java
a) Create an abstract class Discount Policy. It should have a singie abstract method comp uteDiscount that will return the discount from the purchase of a given number of a single i tem. The method has two parameters, count and itemcost b) Derive a class BuyNItemsGetoneFree from DiscountPolicy. It should have a constructor that has a single parametern. The data member of this class will be 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 counts of an item that costs $10, when n is 3: 6 20 Count 0 10 10 10 20 Discount Which means if the customer buys 7 items, then the discount will be $20 since every 3rd item will be free. If n is 4 and if the user buys 7 items, then the discount will be $10. c) Create testing class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
