-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRestaurant.java
More file actions
154 lines (131 loc) · 4.5 KB
/
Copy pathRestaurant.java
File metadata and controls
154 lines (131 loc) · 4.5 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package ifStatement.review;
import java.io.*;
public class Restaurant {
static double mealCost, hst, tip, totalCost;
static int mealSelection, popNum;
static String pop;
@SuppressWarnings("deprecation")
public static void main(String[] args) throws IOException {
DataInputStream input = new DataInputStream(System.in);
System.out.println("Welcome to Costco, following is our menu:");
System.out.println(" 1 - Whole beef hotdog $1.5");
System.out.println(" 2 - Pizza slice $2.29");
System.out.println(" 3 - Fries and chicken stripe $6.49");
System.out.println(" 4 - Pountine $4.49");
System.out.println(" 5 - Ten pieces chicken $6.79");
System.out.println("");
System.out.print("Please enter your selection: ");
mealSelection = Integer.parseInt(input.readLine());
if (mealSelection == 1) {
System.out.println("You ordered Combo one");
System.out.print("Would you like additional pop for $1 each? Y/N");
pop = input.readLine();
if (pop.equalsIgnoreCase("Y")) {
System.out.print("How many pop would you like");
popNum = Integer.parseInt(input.readLine());
if (popNum < 1) {
System.out.println("I can't give you this many pop");
mealCost = 1.5;
} else if (popNum > 100) {
System.out.println("Do not waste any pop");
mealCost = 1.5;
} else {
mealCost = 1.5 + popNum;
}
} else {
mealCost = 1.5;
}
}
else if (mealSelection == 2) {
System.out.println("You ordered Combo two");
System.out.print("Would you like additional pop for $1 each? Y/N");
pop = input.readLine();
if (pop.equalsIgnoreCase("T")) {
System.out.print("How many pop would you like");
popNum = Integer.parseInt(input.readLine());
if (popNum < 1) {
System.out.println("I can't give you this many pop");
mealCost = 2.29;
} else if (popNum > 100) {
System.out.println("Do not waste any pop");
mealCost = 2.29;
} else {
mealCost = 2.29 + popNum;
}
} else {
mealCost = 2.29;
}
}
else if (mealSelection == 3) {
System.out.println("You ordered Combo three");
System.out.print("Would you like additional pop for $1 each? Y/N");
pop = input.readLine();
if (pop.equalsIgnoreCase("Y")) {
System.out.print("How many pop would you like");
popNum = Integer.parseInt(input.readLine());
if (popNum < 1) {
System.out.println("I can't give you this many pop");
mealCost = 6.49;
} else if (popNum > 100) {
System.out.println("Do not waste any pop");
mealCost = 6.49;
} else {
mealCost = 6.49 + popNum;
}
} else {
mealCost = 6.49;
}
}
else if (mealSelection == 4) {
System.out.println("You ordered Combo four");
System.out.print("Would you like additional pop for $1 each? Y/N");
pop = input.readLine();
if (pop.equalsIgnoreCase("Y")) {
System.out.print("How many pop would you like");
popNum = Integer.parseInt(input.readLine());
if (popNum < 1) {
System.out.println("I can't give you this many pop");
mealCost = 4.49;
} else if (popNum > 100) {
System.out.println("Do not waste any pop");
mealCost = 4.49;
} else {
mealCost = 4.49 + popNum;
}
} else {
mealCost = 4.49;
}
}
else if (mealSelection == 5) {
System.out.println("You ordered Combo one");
System.out.print("Would you like additional pop for $1 each? Y/N");
pop = input.readLine();
if (pop.equalsIgnoreCase("y")) {
System.out.print("How many pop would you like");
popNum = Integer.parseInt(input.readLine());
if (popNum < 1) {
System.out.println("I can't give you this many pop");
mealCost = 6.79;
} else if (popNum > 100) {
System.out.println("Do not waste any pop");
mealCost = 6.79;
} else {
mealCost = 6.79 + popNum;
}
} else {
mealCost = 6.79;
}
} else {
System.out.println("That is a invalid combo number");
System.out.println("Exit the program, please run again");
System.exit(1);
}
hst = mealCost * 0.13;
tip = mealCost * 0.15;
totalCost = mealCost + hst + tip;
System.out.println("Meal Cost $" + mealCost);
System.out.println("HST $" + hst);
System.out.println("Tip $" + tip);
System.out.println("Total cost &" + totalCost);
}
}