Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Java code how would I create an interface Discount Policy. Create an interface DiscountPolicy. It should have a single method computeDiscount thatwill return the
Using Java code how would I create an interface Discount Policy. Create an interface DiscountPolicy. It should have a single method computeDiscount thatwill return the discount for the purchase of a given number of a single item. The methodhas two parameters, count and itemCost.Derive a class BulkDiscount from DiscountPolicy. It should have a constructor that hastwo parameters minimum and percent. It should define the method computeDiscount sothat if the quantity purchased of an item is more than minimum, the discount is percentpercent.Create a BuyXGetOneFree class that implements the interface DiscountPolicy. This should use a method to set the X value and give the discount value for that amount of items. This criterion is linked to a Learning OutcomeInterface for Discount PolicyThis criterion is linked to a Learning OutcomeMethod for InterfaceMust contain appropriate parameters and return a doubleThis criterion is linked to a Learning OutcomeCreate Bulk Discount ClassThis criterion is linked to a Learning OutcomeCorrect class variablesThis criterion is linked to a Learning OutcomeEncapsulatedThis criterion is linked to a Learning OutcomeCompute Discount Method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started