-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestaurants.java
68 lines (48 loc) · 1.75 KB
/
Restaurants.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.util.Scanner;
public class Restaurants {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
boolean quit= false;
int sum=0;
int wine=200,cold=20,bear=400,juice=100;
String order="";
do{
System.out.println("ITEM"+"\t\tPrice");
System.out.println("1.Wine"+"\t\t"+"200");
System.out.println("2.ColdDrink"+"\t"+"20");
System.out.println("3.Bear"+"\t\t"+"400");
System.out.println("4.Juice"+"\t\t"+"100");
System.out.println("5.Quit");
int choice=input.nextInt();
switch(choice){
case 1:System.out.println("Wine"+"\n");
sum=sum+wine;
order=order.concat("wine"+"\n");
break;
case 2:
System.out.println("ColdDrink");
sum=sum+cold;
order=order.concat("ColdDrink"+"\n");
break;
case 3:
System.out.println("Bear");
sum=sum+bear;
order=order.concat("Bear"+"\n");
break;
case 4:
System.out.println("Juice");
sum=sum+juice;
order=order.concat("Juice"+"\n");
break;
case 5:
quit=true;
break;
default:
System.out.println("Wrong input");
}
}while(!quit);
System.out.println("Your Orders are:\n"+order);
System.out.println("Your total bill="+sum);
System.out.println("Thank you");
}
}