Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.0Step 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