так что в основном мне нужно создать меню, которое попросит пользователя выбрать еду, а затем продолжать делать это, пока не будет нажата шестерка.Также я должен суммировать деньги, которые пользователь должен дать, и добавить налог в размере 8%.Здесь используется формат «Объявление переменных». Выходное меню «Начать во время цикла» (не используйте номер пункта меню для условия цикла). Запросить номер элемента. Стартовое переключение оператора Каждый случай должен выглядеть следующим образом. Запросить количество Определить цену для заказанных элементов.Упорядоченные элементы. Задание по умолчанию - изменить переменную цикла, чтобы разорвать цикл. Вычислить налог и общий итог. Вывести общее количество элементов, промежуточный итог, налог и общий итог
import java.util.Scanner;
public class lab8a{
public static void main(String[] args) {
// TODO Auto-generated method stub
//This is the menu that you choose from
Int sum=0;
System.out.println("1- Coffee and Donut- $3.50");
System.out.println("2- Coffee and Bagel- $3.75");
System.out.println("3- Coffee, Donut and Juice- $4.00");
System.out.println("4- 1/2 dozen donuts- $5.00");
System.out.println("5- 1 dozen donuts- $7.50");
Scanner input1= new Scanner(System.in);
System.out.print(“Enter 6 to exit or any other # to continue);
Int cont=input.nextInt();
System.out.print();
while(cont!=6){
Scanner input= new Scanner(System.in);//creates scanner for menu
System.out.println("choose the number of the order");//order based on
integer input
int menu= input.nextInt();
System.out.println();//prints out # chosen
double menu3= menu2;//switches the menu2 to a double to do math with decimals
switch (menu) {
case 1:
Scanner input2= new Scanner(System.in);//second scanner for quantity
System.out.println("How Many?");
int item1= input.nextInt();
System.out.println();//prints out # of orders
System.out.print("You are ordering " + item1+ " orders of coffee and donut for a total of $" + 3.50*item1);//prints out order and total
System.out.println("");
sum+=3.50*item1;
break;//break for cases
case 2:
Scanner input3= new Scanner(System.in);//second scanner for quantity
System.out.println("How Many?");
int item2= input.nextInt();
System.out.println();//prints out # of orders
System.out.print("You are ordering " + item2+ " orders of coffee and bagel for a total of $" + 3.75*item4);
System.out.println("");
s+=3.75*item2;
break;
case 3:
Scanner input4= new Scanner(System.in);//second scanner for quantity
System.out.println("How Many?");
int item3= input.nextInt();
System.out.println();//prints out # of orders
System.out.print("You are ordering " + item3+ " orders of Coffee, Donut, and Juice for a total of $" + 4.00*item3);
System.out.println("");
s+=4.00*item3
break;
case 4:
Scanner input5= new Scanner(System.in);//second scanner for quantity
System.out.println("How Many?");
int item4= input.nextInt();
System.out.println();//prints out # of orders
System.out.print("You are ordering " + item4+ " orders of 1/2 dozen donuts for a total of $" + 5.00*item4);
System.out.println("");
s+=5.00*item4;
break;
case 5:
Scanner input6= new Scanner(System.in);//second scanner for quantity
System.out.println("How Many?");
int item5= input.nextInt();
System.out.println();//prints out # of orders
System.out.print("You are ordering " + item5+ " orders of 1 dozen donuts for a total of $" + 7.00*item5);
System.out.println("");
s+=7.00*item5;
Break;
}
System.out.print(“Your subtotal is “ +sum);
System.out.println(“Your total is” + sum*1.08);
}
so what is supposed to happen is that I ask the user what they want to
order and continue asking them. Also I have to add up the price of the
orders and output the overall price when the user exits