Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed

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

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

Step: 3

blur-text-image

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

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions