Question: 2. Write a Java program that calculates sales price. Your program will prompt the user for information about two parameters: membership ID(data type: String) and

2. Write a Java program that calculates sales price. Your program will prompt the user for information about two parameters: membership ID(data type: String) and input number of price. One method should receive the parameters and return how much money to pay to buy the good. The customer should receive discount of 10% from the original price if membership ID starts with A and receive discount of 5% if membership ID starts with B. For example, the call pay(100.0, A301F) should return 90.0. (eg: 100 - (100* 0.1) = 90.0). If ID starts with neither A nor B, 0% discount rate is applied. User ID must be 5 digits-length and ends with either F or M. If user typed wrong ID, ask user to input ID again. If the user input 0 for the ID, then your program will terminate with Good Bye! message. Otherwise your program does run repeatedly. You must use while loops

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!