Question: In Java Method #1: Write a method getDiscountAmount, the method receives a single letter code (char) and a price (double), returns a discount amount (double)

 In Java Method #1: Write a method getDiscountAmount, the method receives

In Java

Method #1: Write a method getDiscountAmount, the method receives a single letter code (char) and a price (double), returns a discount amount (double) using following chart: Letter Code Discount Rate 'P' or 'p': 10% of price 'K' or 'k': 20% of price 'W' or 'w': 40% of price any other code: 0% discount (which means 0.0) signature: public static double getDiscountAmount(char code, double price) Examples: getDiscountAmount('g 100.00) returns 10.00 getDiscountAmount('S! 100.00) returns 20.00 getDiscountAmount('x200.00) returns 80.00 getDiscountAmount('y.400.00) returns 0.0

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!