Question: java question 1 Consider the following abstract class BaseDiscount: abstract class BaseDiscount [ public abstract double getDiscount(int count, double itemCost); It has a single abstract

java question 1

java question 1 Consider the following abstract class BaseDiscount: abstract class BaseDiscount

Consider the following abstract class BaseDiscount: abstract class BaseDiscount [ public abstract double getDiscount(int count, double itemCost); It has a single abstract getDiscount() method that returns the discount for the purchase of a given number of a single item. Derive a class BulkDiscount from DiscountBasic. It should have a constructor that has two parameters, minimum and percentoff. It should override the method getDiscount() so that if the quantity purchased of an item exceeds the minimum, then calculate the discount amount using the percentoff percentage. For example: if a customer has 5% off on 10 or more items and the total of purchase is 25 items at $6 each, then the discount is $7.5. (i.e. 25 6 5/100.0) Write the BulkDiscount class in the answer box below. Note: you can assume that the DiscountBasic 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 BulkDiscount bulk1 - new BulkDiscount (10, 5.0); System.out.println("5% off on over 10 items "); System.out.println(bulk1.getDiscount(5, 5.0)); 5% off on over 10 items 0.0 BulkDiscount bulk1 - new BulkDiscount (10, 5.0); System.out.println("5% off on over 10 items "); System.out.println(bulk1.getDiscount (25, 6.0)); 5% off on over 10 items 7.5 Answer: (penalty regime: 0 %) 1 class BulkDiscount extends

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!