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 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
Get step-by-step solutions from verified subject matter experts
