Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Optimization And Data Science Trends And Applications 5th Airoyoung Workshop And Airo Phd School 2021 Joint Event

Authors: Adriano Masone ,Veronica Dal Sasso ,Valentina Morandi

1st Edition

3030862887, 978-3030862886

More Books

Students also viewed these Databases questions

Question

1. Describe the power of nonverbal communication

Answered: 1 week ago