Question: use eclipse and Please use the latest version and make a code using the correct answer to the question I posted and these four things
use eclipse and Please use the latest version and make a code using the correct answer to the question I posted and these four things I suggested.
1. Scanner keyboard = new Scanner(System.in);
2.String input = keyboard.nextLine();
3.While(input.equal("n")){
}
4. boolean flag
Please make a code using scanner keyboard, input, Boolean, and while.
You are asked to implement a Console application called CoffeeMachine.cs for a Coffee Vending Machine System. It allows customers to purchase a coffee at a time. The program must show the coffees and the corresponding prices of different sizes (small, medium, large) as follows. The program must be able to collect the purchase information from the customer to complete the order. 5% tax should be added when calculating the price after confirmation.
|
Coffee Type | Small Price | Medium Price | Large Price |
| Latte | $3.70 | $4.45 | $5.00 |
| Americano | $2.95 | $3.50 | $4.10 |
| Cappuccino | $3.70 | $4.55 | $5.00 |
| Caramel Macchiato | $3.75 | $4.50 | $5.00 |
| Mocha | $4.50 | $5.40 | $6.00 |
- Your program must be able to produce the same output.
- E.g., "(S)mall" and "Small" are considered as different output
- "purchase!" and "purchase" are considered as different output
- You must create a class called Coffee to model a coffee. The class Coffee contains the followings, but not limited to, the following private instance variables:
- name (String)
- largePrice (double)
- mediumPrice (double)
- smallPrice (double)
- You may assume the user input must be valid.
Sample Run of Program
The followings show two sample runs of the program.
Sample Run#1 (Green text refers to user input)
Welcome to N&I Cafe Please choose your coffee
Coffee 1: Latte
Coffee 2: Americano
Coffee 3: Cappuccino
Coffee 4: Caramel Macchiato
Coffee 5: Mocha
Enter the coffee number >> 3
Please choose the size (S/M/L):
(S)mall: $3.70 / (M)edium: $4.55 / (L)arge: $5.00 >> M
Confirm you order (Y/N): Y
Thank you for your purchase!
Your Medium Cappuccino is ready to serve. Total cost: $4.78
Sample Run#2
Sample Run#2
Welcome to N&I Cafe Please choose your coffee
Coffee 1: Latte
Coffee 2: Americano
Coffee 3: Cappuccino
Coffee 4: Caramel Macchiato
Coffee 5: Mocha
Enter the coffee number >> 1
Please choose the size (S/M/L):
(S)mall: $3.70 / (M)edium: $4.45 / (L)arge: $5.00 >> S
Confirm you order (Y/N): N
Welcome to N&I Cafe Please choose your coffee
Coffee 1: Latte
Coffee 2: Americano
Coffee 3: Cappuccino
Coffee 4: Caramel Macchiato
Coffee 5: Mocha
Enter the coffee number >> 2
Please choose the size (S/M/L):
(S)mall: $2.95 / (M)edium: $3.50 / (L)arge: $4.10 >> L
Confirm you order (Y/N): N
Welcome to N&I Cafe Please choose your coffee
Coffee 1: Latte
Coffee 2: Americano
Coffee 3: Cappuccino
Coffee 4: Caramel Macchiato
Coffee 5: Mocha
Enter the coffee number >> 5
Please choose the size (S/M/L):
(S)mall: $4.50 / (M)edium: $5.40 / (L)arge: $6.00 >> L
Confirm you order (Y/N): Y
Thank you for your purchase!
Your Large Mocha is ready to serve. Total cost: $6.30
Please make a code using scanner keyboard, input, Boolean, and while. I don't want step by step, but I'd appreciate it if you could show me all the codes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
