-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreBookMeals.java
514 lines (453 loc) · 16.9 KB
/
PreBookMeals.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
/**
* Write a description of class PreBookMeals here.
*
* @author (your obj.name)
* @version (a version number or a date)
*/
import java.util.Scanner;
public class PreBookMeals
{
int people = 0 ;
int time = 0 ;
int bill = 0 ;
int foodType = 0 ;
String table = "" ;
String timeColon = "" ;
String feedback = "" ;
String timeColon2 = "" ;
String response = "" ;
InputDetails obj = new InputDetails();
void peopleCapacity(InputDetails obj)
{
Scanner sc = new Scanner(System.in) ;
System.out.println("\n\nHi! " + obj.name + " for how many people do you want to reserve the seat? ") ;
people = sc.nextInt();
}
void peopleCapacityCheck(InputDetails obj)
{
if(people < 0 )
{
System.out.println("\nOOPS‼ looks like you have entered a negative value for people! ");
peopleCapacity(obj);
}
if(people >= 50)
{
System.out.println("\nOOPS‼ we donot have seats for "+ people +" people today \nYou can contact our manager +91 97*** ***** ☺" );
peopleCapacity(obj);
}
}
void timeReserve()
{
Scanner sc = new Scanner(System.in);
System.out.println("\nAt what time do you want to reserve the seat for " + people + "\nPlease enter time in 24:00 hour format");
timeColon = sc.nextLine().trim();
timeColon2 = timeColon ;
timeColon();
}
void timeColon()
{
int count = 0 ;
//removes the ':' in the time if there is any present in it
for(int i = 0 ; i < timeColon.length(); i++)
{
char ch = timeColon.charAt(i);
if(ch == ':')
{
int index = timeColon.indexOf(':');
String firstHalf = timeColon.substring(0,index);
String secondHalf = timeColon.substring((index+1));
if( Integer.parseInt(secondHalf) >= 60 )
{
System.out.println("\nPlease make sure that you are entering a valid timings");
timeReserve();
}
String time = firstHalf.concat(secondHalf);
this.time = Integer.parseInt(time);
count++ ;
break;
}
}
if (count == 0)
{
this.time = Integer.parseInt(timeColon) ;
}
timeCheck();
}
void timeCheck()
{
if(time >= 800 && time <= 2200)
{
vegORnonveg();
}
else
{
System.out.println("\nthe hotel will be closed at that time please select another time for the visit ");
timeReserve();
}
}
void tableReserve()
{
Scanner sc = new Scanner(System.in);
System.out.println("\nWhere do you want to reserve your table for " + people + "\nOption : \n(a) Barbeque \n(b) Pool Facing \n(c) Garden \n(please choose a, b or c)") ;
table = sc.nextLine().trim();
}
void tableCheck()
{
if(table.equalsIgnoreCase("a"))
{
table = "Barbeque" ;
}
else if (table.equalsIgnoreCase("b"))
{
table = "Pool Facing" ;
}
else if(table.equalsIgnoreCase("c"))
{
table = "Garden" ;
}
else
{
System.out.println("\nLooks like your table reservation was invalid please check the spelling, case doesnot matter");
tableReserve();
}
}
void vegORnonveg()
{
Scanner sc = new Scanner(System.in);
System.out.println("");
System.out.println("§§§§§§§§§§§§§§§ M E N U §§§§§§§§§§§§§§§");
System.out.println("§ §");
System.out.println("§ 1. Vegitarian §");
System.out.println("§ 2. Non Vegitarian §");
System.out.println("§ 3. Fast Food §");
System.out.println("§ §");
System.out.println("§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§");
int foodType = sc.nextInt();
//checking if it is veg or nonveg
switch(foodType)
{
case 1: menuDisplay_veg();
break;
case 2: menuDisplay_NonVeg();
break;
case 3: menuDisplay_FastFood();
default:
while( foodType == 1 || foodType == 2)
{
System.out.println("\nOOPS!! looks like you have made a wrong choice! \nPlease make your choice");
foodType = sc.nextInt();
}
break;
}
}
void menuDisplay_veg()
{
System.out.println("\f");
if(time >= 800 && time <= 1200)
{
System.out.println("**********♣VEG BREAKFAST MENU♣*********");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("1.Idli (2 pcs.) ₹ 40");
System.out.println("2.Vada (2 pcs.) ₹ 40");
System.out.println("3.Idli Vada ₹ 45");
System.out.println("4.Masal Dosa ₹ 45");
System.out.println("5.Kesari bath ₹ 35");
System.out.println("6.Upma ₹ 50");
System.out.println("7.Set Dosa ₹ 50");
System.out.println("8.Puri ₹ 55");
System.out.println(" ");
System.out.println("************♣BEVERAGE MENU♣************");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("9.Coffee ₹ 20");
System.out.println("10.Tea ₹ 20");
System.out.println("11.Cold Coffee ₹ 45");
System.out.println("12.Masala Tea ₹ 45");
//taking line of execution to method billComputeBreakfast()
billCompute_Breakfast_Veg();
}
else if(time >= 1200 && time <= 2200)
{
System.out.println("************♣VEG LUNCH MENU♣************");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("1.Roti ₹ 40");
System.out.println("2.Paneer Butter Masala ₹ 60");
System.out.println("3.Dal Makhni ₹ 60");
System.out.println("4.South Indian Meal ₹ 160");
System.out.println("5.North Indian Meal ₹ 160");
System.out.println("***************♣BEVERAGES♣***************");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("6.Coffee ₹ 20");
System.out.println("7.Tea ₹ 20");
System.out.println("8.Cold Coffee ₹ 45");
System.out.println("9.Masala Tea ₹ 45");
System.out.println("10.Ice Tea ₹ 60");
System.out.println("11.Milk Shake ₹ 60");
//taking execution of program to billComputeLunch()
billCompute_Lunch_Veg();
}
}
void menuDisplay_NonVeg()
{
System.out.println("\f");
System.out.println("*****♣NON VEG BREAKFAST/LUNCH MENU♣****");
System.out.println(" ");
System.out.println("ITEM PRICE");
System.out.println("1.Tandoori Chicken ₹ 40");
System.out.println("2.Afghani Chicken ₹ 40");
System.out.println("3.Chicken Tikka ₹ 45");
System.out.println("4.Mutton Sheek Kebab ₹ 45");
System.out.println("5.Chicken Stuff Kebab ₹ 50");
System.out.println("6.Chicken Biriyani ₹ 50");
System.out.println("7.Chicken Noodles ₹ 50");
System.out.println("8.Meat Balls ₹ 55");
System.out.println("************♣BEVERAGE MENU♣************");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("9.Coffee ₹ 20");
System.out.println("10.Tea ₹ 20");
System.out.println("11.Cold Coffee ₹ 45");
System.out.println("12.Masala Tea ₹ 45");
//taking line of execution to method billComputeBreakfast()
billCompute_NonVeg();
}
void menuDisplay_FastFood()
{
System.out.println("\f");
System.out.println("************♣FAST FOOD MENU♣***********");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("1.Burger Veg ₹ 40");
System.out.println("2.Burger Non Veg ₹ 40");
System.out.println("3.Pastry (Egg less) ₹ 45");
System.out.println("4.Sandwhich ₹ 45");
System.out.println("5.Pastry (With egg) ₹ 50");
System.out.println("6.Pizza ₹ 100");
System.out.println("7.Cake ₹ 100");
System.out.println("8.Donut (4 pic) ₹ 100");
System.out.println(" ");
System.out.println("************♣BEVERAGE MENU♣************");
System.out.println("ITEM PRICE");
System.out.println(" ");
System.out.println("9.Coffee ₹ 20");
System.out.println("10.Tea ₹ 20");
System.out.println("11.Cold Coffee ₹ 45");
System.out.println("12.Masala Tea ₹ 45");
//taking line of execution to method billComputeBreakfast()
billCompute_FastFood();
}
void billCompute_Breakfast_Veg()
{
//calling Scanner class
Scanner sc = new Scanner(System.in);
//declaraton and initialization
int n = 1 ;
int q = 1 ;
int check = 1 ;
//display statement
System.out.println();
//loop to calculate bill
while( check > 0 )
{
//display sttement
System.out.println("Please enter serial number ");
n = sc.nextInt();
System.out.println("Please enter quantity");
q = sc.nextInt();
if( n == 9 || n == 10 )
{
bill = bill + 20 * q ;
}
else if( n == 5)
{
bill = bill + 35 * q ;
}
else if( n == 1 || n == 2 )
{
bill = bill + 40 * q ;
}
else if( n == 3 || n == 4 || n == 11 || n == 12)
{
bill = bill + 45 * q ;
}
else if( n == 6 || n == 7 )
{
bill = bill + 50 * q ;
}
else if( n == 8)
{
bill = bill + 55 * q ;
}
System.out.println("continue / exit (1/0)");
check = sc.nextInt();
}
}
void billCompute_Lunch_Veg()
{
//calling Scanner class
Scanner sc = new Scanner(System.in);
//declaraton and initialization
int n = 1 ;
int q = 1 ;
int check = 1 ;
//display statement
System.out.println();
//loop to calculate bill
while( check > 0 )
{
//display sttement
System.out.println("Please enter serial number ");
n = sc.nextInt();
System.out.println("Please enter quantity");
q = sc.nextInt();
if( n == 6 || n == 7 )
{
bill = bill + 20 * q ;
}
else if( n == 1 )
{
bill = bill + 40 * q ;
}
else if( n == 8 || n == 9 )
{
bill = bill + 45 * q ;
}
else if(n == 2 || n == 3 || n == 10 || n == 11)
{
bill = bill + 60 * q ;
}
else if( n == 4 || n == 5 )
{
bill = bill + 160 * q ;
}
System.out.println("continue / exit (1/0)");
check = sc.nextInt();
}
}
void billCompute_NonVeg()
{
//calling Scanner class
Scanner sc = new Scanner(System.in);
//declaraton and initialization
int n = 1 ;
int q = 1 ;
int check = 1 ;
//display statement
System.out.println();
//loop to calculate bill
while( check > 0 )
{
//display sttement
System.out.println("Please enter serial number ");
n = sc.nextInt();
System.out.println("Please enter quantity");
q = sc.nextInt();
if( n == 9 || n == 10 )
{
bill = bill + 20 * q ;
}
else if( n == 5)
{
bill = bill + 50 * q ;
}
else if( n == 1 || n == 2 )
{
bill = bill + 40 * q ;
}
else if( n == 3 || n == 4 || n == 11 || n == 12)
{
bill = bill + 45 * q ;
}
else if( n == 6 || n == 7 )
{
bill = bill + 50 * q ;
}
else if( n == 8)
{
bill = bill + 55 * q ;
}
System.out.println("continue / exit (1/0)");
check = sc.nextInt();
}
}
void billCompute_FastFood()
{
//calling Scanner class
Scanner sc = new Scanner(System.in);
//declaraton and initialization
int n = 1 ;
int q = 1 ;
int check = 1 ;
//display statement
System.out.println();
//loop to calculate bill
while( check > 0 )
{
//display sttement
System.out.println("Please enter serial number ");
n = sc.nextInt();
System.out.println("Please enter quantity");
q = sc.nextInt();
if( n == 9 || n == 10 )
{
bill = bill + 20 * q ;
}
else if( n == 5)
{
bill = bill + 50 * q ;
}
else if( n == 1 || n == 2 )
{
bill = bill + 40 * q ;
}
else if( n == 3 || n == 4 || n == 11 || n == 12)
{
bill = bill + 45 * q ;
}
else if( n == 6 || n == 7 )
{
bill = bill + 100 * q ;
}
else if( n == 8)
{
bill = bill + 100 * q ;
}
System.out.println("continue / exit (1/0)");
check = sc.nextInt();
}
}
void finalDisplay(InputDetails obj)
{
Scanner sc = new Scanner(System.in);
System.out.println("\nWelcome " + obj.name + " your seat reservation (" + table + ") at " + timeColon2 + " has been confirmed ☺ ");
try{
Thread.sleep(1000);
}
catch(Exception e)
{
}
System.out.println();
try{
Thread.sleep(1000);
}
catch(Exception e)
{
}
String display = "Processing bill estimates.......";
for(int i = 0 ;i < display.length() ; i++)
{
char ch = display.charAt(i);
System.out.print(ch);
try
{
Thread.sleep(55);
}
catch(Exception e)
{
}
}
}
}