Question
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
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
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