Untitled
unknown
plain_text
2 years ago
13 kB
2
Indexable
Never
import java.util.Scanner; public class menu { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Hi there!\n"); System.out.println("Welcome to the menu of" + " Salam Bro! " + " Fast Food Station."); System.out.println("Here you can see our menu below."); String basket = ""; int totalSum = 0; while(true) { System.out.println("0. Exit menu" + '\n' + "1. Burgers." + '\n' + "2. Hot dogs." + '\n' + "3. French fries." + '\n' + "4. Drinks." + '\n' + "5. Sauces." + '\n' + "6. Additives." + '\n' + "7. Clear basket." + '\n' + "8. Check basket." ); System.out.print("Choose one: "); int n = sc.nextInt(); switch (n) { case 0: break; // выход из switch case 1: System.out.println("0. Exit menu" + '\n' + "1. Chicken hamburger - 590 kzt" + '\n' + "2. Beef hamburger - 790 kzt" + '\n' + "3. Chicken cheeseburger - 790 kzt" + '\n' + "4. Beef cheeseburger - 890 kzt" + '\n' + "5. Double chicken hamburger - 990 kzt" + '\n' + "6. Double chicken cheeseburger - 1090 kzt" + '\n' + "7. Double beef hamburger - 1090 kzt" + '\n' + "8. Double beef cheeseburger - 1190 kzt" + '\n' + "9. Mixed hamburger - 1090 kzt" + '\n' + "10. Mixed cheeseburger - 1190 kzt" ); System.out.println("Choose a burger"); int x = sc.nextInt(); switch (x) { case 0: break; case 1: System.out.println("Added chicken hamburger to your basket"); totalSum += 590; basket += " Chicken hamburger - 590" + '\n'; break; case 2: System.out.println("Added beef hamburger to your basket"); totalSum += 790; basket += " Beef hamburger - 790 kzt" + '\n'; break; case 3: System.out.println("Added chicken cheeseburger to your bakset"); totalSum += 790; basket += " Chicken cheeseburger - 790 kzt" + '\n'; break; case 4: System.out.println("Added beef cheeseburger to your basket"); totalSum += 890; basket += " Beef cheeseburger - 890 kzt" + '\n'; break; case 5: System.out.println("Added double chicken hamburger"); totalSum += 990; basket += "Double chicken hamburger - 990 kzt" + '\n'; break; case 6: System.out.println("Added chicken cheeseburger"); totalSum += 1090; basket += "Chicken cheeseburger - 1090 kzt" + '\n'; break; case 7: System.out.println("Added double beef hamburger"); totalSum += 1090; basket += "Double beef hamburger - 1090 kzt" + '\n'; break; case 8: System.out.println("Added double beef cheeseburger"); totalSum += 1190; basket += "Double beef cheeseburger - 1190 kzt" + '\n'; break; case 9: System.out.println("Added mixed hamburger"); totalSum += 1090; basket += "Mixed hamburger - 1090 kzt" + '\n'; break; case 10: System.out.println("Added mixed cheeseburger"); totalSum += 1190; basket += "Mixed cheeseburger - 1190 kzt" + '\n'; } break; case 2: System.out.println("0. Exit menu" + '\n' + "1. Spicy hot dog - 590 kzt" + '\n' + "2. Hot dog - 590 kzt" ); System.out.println("Choose a hot dog: "); int z = sc.nextInt(); switch (z) { case 0: break; case 1: System.out.println("Spicy hot dog added to your basket"); totalSum +=590; basket += "Spicy hot dog - 590 kzt" + '\n'; break; case 2: System.out.println("Hot dog added to your basket"); totalSum +=590; basket += "Hot dog - 590 kzt" + '\n'; } break; case 3: System.out.println("0. Exit menu" + '\n' + "1. French fries - 390 kzt" ); System.out.println("Choose a french fries: "); int a = sc.nextInt(); switch (a) { case 0: break; case 1: System.out.println("French fries added to your basket"); totalSum += 390; basket += "French fries - 390 kzt" + '\n'; } break; case 4: System.out.println("0. Exit menu" + '\n' + "1. Coca-Cola 0.51 - 250 kzt" + '\n' + "2. Fanta 0.51 - 250 kzt" + '\n' + "3. Sprite 0.51 - 250 kzt" + '\n' + "4. Fuse tea 0.51 - 250 kzt" + '\n' + "5. Bon aqua 0.51 - 250 kzt" + '\n' + "6. Raspberry compote 0.31 - 250 kzt" + '\n' + "7. Currant compote 0.31 - 250 kzt" + '\n' + "8. Piko pulpy 0.51 - 350 kzt" ); System.out.println("Choose a drink: "); int b = sc.nextInt(); switch (b) { case 0: break; case 1: System.out.println("Coca-Cola added to your basket"); totalSum += 250; basket += "Coca-Cola 0.51 - 250 kzt" + '\n'; break; case 2: System.out.println("Fanta added to your basket"); totalSum += 250; basket += "Fanta 0.51 - 250 kzt" + '\n'; break; case 3: System.out.println("Sprite added to your basket"); totalSum += 250; basket += "Sprite 0.51 - 250 kzt" + '\n'; break; case 4: System.out.println("Fuse tea added to your backet"); totalSum += 250; basket += "Fuse tea 0.51 - 250 kzt" + '\n'; break; case 5: System.out.println("Bon aqua added to your basket"); totalSum += 250; basket += "Bon aqua 0.51 - 250 kzt" + '\n'; break; case 6: System.out.println("Raspberry compote added to your basket"); totalSum += 250; basket += "Raspberry compote 0.31 - 250 kzt" + '\n'; break; case 7: System.out.println("Currant compote added to your basket"); totalSum += 250; basket += "Currant compote 0.31 - 250 kzt" + '\n'; break; case 8: System.out.println("Piko pulpy added to your compote"); totalSum += 350; basket += "Piko pulpy 0.51 - 350 kzt" + '\n'; } break; case 5: System.out.println("0. Exit menu" + '\n' + "1. Ketchup - 100 kzt" + '\n' + "2. Cheese sauce - 100 kzt" + '\n' + "3. Sauce BBQ - 100 kzt" + '\n' + "4. Spicy sauce - 50 kzt" + '\n' + "5. Mustard sauce - 100 kzt" ); System.out.println("Choose a sauce: "); int y = sc.nextInt(); switch (y) { case 0: break; case 1: System.out.println("Ketchup added to your basket"); totalSum += 100; basket += "Ketchup - 100 kzt" + '\n'; break; case 2: System.out.println("Cheese sauce added to your basket"); totalSum += 100; basket += "Cheese sauce - 100 kzt" + '\n'; break; case 3: System.out.println("Sauce BBQ added to your basket"); totalSum += 100; basket += "Sauce BBQ - 100 kzt" + '\n'; break; case 4: System.out.println("Spicy sauce added to your basket"); totalSum += 50; basket += "Spicy sauce - 50 kzt" + '\n'; break; case 5: System.out.println("Mustard sauce added to your basket"); totalSum +=100; basket += "Mustard sauce - 100 kzt" + '\n'; } break; case 6: System.out.println("0. Exit menu" + '\n' + "1. Jalapeno - 100kzt" + '\n' + "2. Cheese - 150 kzt" ); System.out.println("Choose a additive: "); int w = sc.nextInt(); switch(w) { case 0: break; case 1: System.out.println("Jalapeno added to your basket"); totalSum += 100; basket += "Jalapeno - 100 kzt" + '\n'; break; case 2: System.out.println("Cheese added to your basket"); totalSum += 150; basket += "Cheese - 150 kzt" + '\n'; } break; case 7: System.out.println(); basket = " "; totalSum = 0; case 8: System.out.println("These items in your basket: " + basket); System.out.println("Total price: " + totalSum); } } } }