Question: Consider the following abstract class BaseDiscount abstract class BaseDiscount public abstract double getDiscount(int count, double itemCost); It has a single abstract method getDiscount() that returns

 Consider the following abstract class BaseDiscount abstract class BaseDiscount public abstract

Consider the following abstract class BaseDiscount abstract class BaseDiscount public abstract double getDiscount(int count, double itemCost); It has a single abstract method getDiscount() that returns the discount for the purchase of a given number of a single item. Derive a class vIPDiscount from BaseDiscount. It should have a constructor that has two parameters, minAmount and percentoff. It should override the method getDiscount () so that if the total amount purchased is equal to or more than minAmount value, then calculate the discount using the percentoff percentage. For example: if a VIP customer has 20% off $100 or more purchases and the total of purchase is 30 items at $5 each, then the discount is $30. (i.e. 30 5 * 20/100.0) Write the VIPDiscount class in the answer box below. Note: you can assume that the BaseDiscount class has been done for you. Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result VIPDiscount vip1.new VIPDiscount(100, 15.0); System.out . print1n("15% off on $100 or more"); System.out.println(vip1.getDiscount(10, 5.0)); 15% off on $100 or more 0.0 VIPDiscount vip1 = new VIPDiscount(100, 15.0); System.out, print1n("15% off on $100 or more"); System.out.println(vip1.getDiscount(25, 6.0)); 15% off on $100 or more 22.5

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!