Question: Java Programing Display any welcome message at the top of the output screen Create following variables: Price for a cup of coffee (make it adjustable
Java Programing
Display any welcome message at the top of the output screen
Create following variables:
Price for a cup of coffee (make it adjustable within the program)
Number of cups (response from User)
Tax Rate in San Diego is 8%. Define 8% as a CONSTANT variable that never changes
Payment Method (Cash, Credit Card, Store Credit, Gold)
Ask the customer for their first name, and store it as a String object.
Ask the customer (by name) how many cups of coffee they would like to order and save that value.
Calculate the Total (# of cups * Price per Cup) * Sales tax
Using the printf, make all currency data printed to the screen display 2 decimal places, and also a '$" sign.
Also use at least one Decimal Format print method .
Using a switch statement on the payment type
If the user entered 'm' or 'M', display "You are paying using money" to the screen.
If the user entered 'c' or 'C', display "You are paying by Credit Card" to the screen .
If the user entered 's' or 'S;, dispay "You are paying with Store Credit" to the screen.
If the user entered 'g' or 'G', display "You are paying with Gold" to the screen.
If the user entered anything else, display "Invalid payment type, no lemonade for you!", and end the program
Using an if statement, If the quantity is less than 1, then display "Get out of my store, you bum!" and exit the program
Using a single if-else-if statement (also called a multi-branch if-else statement)
If the total is less than $10 and the user is paying by credit card, display "Sorry, there is a $10 minimum purchase for credit card"
If the total is between $10 and $100 (including $10 and $100), and display "Thank you, you earned a free glass of Lemonade!"
If the quantity is greater than 50 or the total is greater than $100, display "I'm going to Disneyland!"
Example Output 1
Welcome to Dave's Java Hut.
Cup of Coffee: $2.00
What is your name? Billy
Hi Billy, how many cups of coffee would you like to order? 5
Subtotal: $10.00
Tax: $0.80
Total: $10.80
How will you be paying, Billy? (Enter 'm' for money, 'c' for credit card, 's' for store credit or 'g' for gold): m
** You are paying using money
** Thank you, you earned a free cup of coffee!
Thanks Billy, and have a nice day!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
