Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Consider the following abstract class DiscountBasic: abstract class DiscountBasic public abstract double getDiscount (int count, double itemCost); It have a single abstract method getDiscount

image text in transcribedJava

Consider the following abstract class DiscountBasic: abstract class DiscountBasic public abstract double getDiscount (int count, double itemCost); It have a single abstract method getDiscount () that retums 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 is more than 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 $75. (ie, 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 to this task because you will be extending it step by step in subsequent tasks For example Test keep a copy of your solution Result BulkDiscount bulkl new BulkDiscount (10, 5.0) System . out.println("5% off on 10 or more items "); System.out.println(bulkl.getDiscount (5, 5.0)) 5% off on 10 or more items ee BulkDiscount bulk1 new BulkDiscount (10, 5.0); System.out.println("5% off on 10 or more items "); System.out.println(bulkl.getDiscount (25, 6.0)) 5% off on 10 or more items 7.5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions