Question
Objective please use dialog boxes for input and output. JOptionPane. Thank you To build a complete working Java program to apply variations on the selection
Objective
please use dialog boxes for input and output. JOptionPane. Thank you
To build a complete working Java program to apply variations on the selection control structure and basic error-testing.
Overview & Instructions
A college coffee shop allows students to charge coffee drinks and then bills them at the end of each month. Write a Java program to determine the monthly bill for the student using the details below. For input, collect the following information:
The number of coffees, lattes, and mochas purchased
A single-character customer code (S for students or F for faculty/staff)
The initial cost will be based on the following:
Type | Cost Each |
Coffee | $1.75 |
Latte | $3.55 |
Mocha | $3.85 |
Tally up the total amount to be charged to a customer based on the number of each type purchased multiplied by the unit cost for the drink.
Next, offer all customers a volume discount using the following scheme:
If total charged is ... | Discount is ... |
up to $20 | 2% |
at least $20, but still under $40 | 5% |
$40 to $60 | 8% |
over $60 but not over $75 | 12% |
above $75 | 20% |
After calculating the total bill, reduce it by the given percentage. Next, offer the following additional special discounts for "power drinkers" at the coffee shop.
Discount | If customer ... | and additional discount is ... |
"Caffeine Fiend" Discount | over 60 coffees | $12 |
'Latte Lover" Discount | over 40 lattes | $18 |
'Mocha Monster" Discount | over 50 mochas | $25 |
Finally, student customers do not have to have tax added, but faculty/staff do. Calculate tax as 6% of the initial monthly cost for the coffee (before any discounts).
Your program should include the following error-checking features:
Number of coffees, lattes, and mochas must all be zero or above
Customer code must be only S or F
Your output should be a clear, organized summary that includes the number of each drink type, the base monthly charge (before any discounts), tax (if any), total discounts, and final amount to be charged. It should be formatted to dollar amounts labels and headings as appropriate.
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