Create a Java program that takes a coffee order from the user. Ask for the size, type, and optional flavoring of the coffee. After getting the input, display a confirmation message with the complete order details.
Reading user input with Scanner
Brew-tiful order, coming right up!
Report a typo
Fill in the gaps with the relevant elements
();
System.out.print("Enter coffee : ");
size ();
System.out.print("Enter coffee : ");
String type = scanner.nextLine();
System.out.print("Enter flavoring (or press Enter for none): ");
String flavoring = scanner.nextLine();
System.out.println("Order confirmed: " + size + " " + type + " coffee" + (flavoring.isEmpty() ? "" : " with " + flavoring + " flavor") + ".");Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.