forked from avani112/HacktoberFest2021-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hotel_AP.java
604 lines (532 loc) · 13.5 KB
/
hotel_AP.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
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
// created by Tanay-Dwivedi
import java.util.Scanner;
import java.util.*;
public class hotel_AP{
public static void main(String [] args)
{
customers [] customer = new customers[10];
customer[0] = new customers();
customer[0].customerData();
admin admin1=new admin();
admin1.adminmenu();
}
}
class customers{
int tableNo;
String name;
int phoneNo;
void customerData()
{
Scanner sc = new Scanner(System.in);
System.out.print("Entere no. :");
tableNo = sc.nextInt();
System.out.print("Entermer name : ");
name = sc.next();
System.out.print("Entere no. :");
phoneNo = sc.nextInt();
}
}
class admin{
String userName;
String passWord;
String username;
String cpassword;
admin()
{
userName="admin";
passWord="system";
}
boolean checkPassword()
{
Scanner sc=new Scanner(System.in);
int couter=0;
do{
System.out.print("Enter name :");
username=sc.next();
System.out.print("Enterword :");
cpassword=sc.next();
boolean flag_check_user;
boolean flag_check_password;
flag_check_user=username.equals(userName);
flag_check_password=cpassword.equals(passWord);
go:{
if (flag_check_user==true)
{
if (flag_check_password==true){
System.out.println("Logines....");
return(true);
}else{
System.out.println("___________________Sorry agian___________________");
++couter;
if (couter==3)
{
break;
}
}
}else{
System.out.println("___________________SorryTry agian___________________");
++couter;
if (couter==3)
{
break;
}
}
}
}while(couter!=3);
return(false);
}
void reserPassword()
{
Scanner sc = new Scanner(System.in);
String psw=passWord;
System.out.print("Enterent password : ");
cpassword=sc.nextLine();
boolean flag_check_password=cpassword.equals(psw);
if(flag_check_password==true)
{
System.out.print("Enterpassword : ");
passWord=sc.next();
System.out.print("Enterpassword agian : ");
String ps=sc.next();
if(passWord.equals(ps))
{
passWord=ps;
System.out.println("Resetwowrs.....");
}
else
{
System.out.print("passwordmatch : ");
}
}
else{
System.out.println("Passwordmatch....");
passWord=psw;
}
{
}
}
void adminmenu()
{
admin admin1=new admin();
Scanner sc=new Scanner(System.in);
int ch;
ch=1;
menu show_menu = new menu();
boolean flag=false;
boolean flag1=false;
boolean flag2;
do{
flag=show_menu.list();
if (flag==true)
{
flag1=admin1.checkPassword();
if(flag1==true)
{
System.out.println("____________________Admin____________________");
System.out.println("1.Add");
System.out.println("2.Remove");
System.out.println("3.Editfile");
System.out.println("4.Resetword");
System.out.println("5.Exit System.out.print("Enter choise : ");
ch=sc.nextInt();
switch(ch)
{
case 1:
show_menu.additem();
break;
case 2:
show_menu.removeitem();
break;
case 3:
show_menu.editprofile();
break;
case 4:
admin1.reserPassword();
break;
case 5:
break;
default:
break;
}
}
}
}while(ch!=5);
}
}
class menu{
int ch;
static int cbill;
admin admin1=new admin();
ArrayList main_menu=new ArrayList();
ArrayList list_southIndian=new ArrayList();
ArrayList prize_southIndian=new ArrayList();
ArrayList list_gujarati=new ArrayList();
ArrayList prize_gujarati=new ArrayList();
ArrayList list_panjabi=new ArrayList();
ArrayList prize_panjabi=new ArrayList();
ArrayList list_chainies=new ArrayList();
ArrayList prize_chainies=new ArrayList();
ArrayList list_tea=new ArrayList();
ArrayList prize_tea=new ArrayList();
ArrayList list_icecream=new ArrayList();
ArrayList prize_icecream=new ArrayList();
ArrayList list_local=new ArrayList();
ArrayList prize_local=new ArrayList();
Scanner sc= new Scanner(System.in);
String hotelName="AP HOTEL";
menu()
{
main_menu.add("1.Southan");
main_menu.add("2.Gujarati main_menu.add("3.chainies main_menu.add("4.panjabi main_menu.add("5.tea main_menu.add("6.icecrime main_menu.add("7.Localutch");
main_menu.add("8.exit
list_southIndian.add("Vadaar");
prize_southIndian.add(100);
list_southIndian.add("Idli Sambar");
prize_southIndian.add(150);
list_southIndian.add("Idli);
prize_southIndian.add(120);
list_southIndian.add("Dahi");
prize_southIndian.add(170);
list_southIndian.add("Upma prize_southIndian.add(100);
list_southIndian.add("Batata);
prize_southIndian.add(120);
list_southIndian.add("Kachori prize_southIndian.add(130);
list_southIndian.add("Vada");
prize_southIndian.add(130);
list_southIndian.add("Sada");
prize_southIndian.add(120);
list_southIndian.add("Butter");
prize_southIndian.add(100);
list_gujarati.add("Roti/Puri prize_gujarati.add(10);
list_gujarati.add("Rice/Dal prize_gujarati.add(40);
list_gujarati.add("Alui/Leelu Shak");
prize_gujarati.add(30);
list_gujarati.add("Papad/Goor prize_gujarati.add(10);
list_gujarati.add("Onion/Tomato prize_gujarati.add(10);
list_gujarati.add("Makkhan/Khichdi prize_gujarati.add(40);
list_gujarati.add("Dhokla prize_gujarati.add(50);
list_gujarati.add("Dahi");
prize_gujarati.add(60);
list_gujarati.add("Bajriotla/Makai na rotla");
prize_gujarati.add(20);
list_gujarati.add("tamatahak");
prize_gujarati.add(50);
list_chainies.add("Prawns");
prize_chainies.add(130);
list_chainies.add("Chineseage");
prize_chainies.add(120);
list_chainies.add("Woron");
prize_chainies.add(170);
list_chainies.add("Cantonese Mein (Lg)");
prize_chainies.add(130);
list_chainies.add("halksls");
prize_chainies.add(160);
list_chainies.add("Beef Mein");
prize_chainies.add(140);
list_chainies.add("Mushroom Mein");
prize_chainies.add(170);
list_chainies.add("Shrimp Mein");
prize_chainies.add(130);
list_chainies.add("BeefTomato Chow Mein (Lg)");
prize_chainies.add(200);
list_chainies.add("Houseial Chow Mein (Lg)");
prize_chainies.add(300);
list_panjabi.add("Sarsonaag Aur Makki Ki Roti");
prize_panjabi.add(200);
list_panjabi.add("Choleure");
prize_panjabi.add(60);
list_panjabi.add("Masalana");
prize_panjabi.add(50);
list_panjabi.add("Dalani");
prize_panjabi.add(100);
list_panjabi.add("Machchlitsari");
prize_panjabi.add(300);
list_panjabi.add("Dhaba);
prize_panjabi.add(70);
list_panjabi.add("Rajma prize_panjabi.add(80);
list_panjabi.add("Lassiala");
prize_panjabi.add(30);
list_panjabi.add("Alootsari");
prize_panjabi.add(150);
list_panjabi.add("Subjio");
prize_panjabi.add(150);
list_tea.add("White);
prize_tea.add(40);
list_tea.add("Green);
prize_tea.add(50);
list_tea.add("Oolong);
prize_tea.add(60);
list_tea.add("Black);
prize_tea.add(70);
list_tea.add("Pu-erh);
prize_tea.add(80);
list_tea.add("Tisanes);
prize_tea.add(80);
list_icecream.add("Baconcream");
prize_icecream.add(70);
list_icecream.add("BeerCream");
prize_icecream.add(100);
list_icecream.add("Blackut ice cream");
prize_icecream.add(120);
list_icecream.add("Blue");
prize_icecream.add(150);
list_icecream.add("Cherrycream");
prize_icecream.add(100);
list_icecream.add("Chocolate cookie dough ice cream");
prize_icecream.add(100);
list_icecream.add("Chocolatecream");
prize_icecream.add(120);
list_local.add("Dabeli prize_local.add(30);
list_local.add("pani");
prize_local.add(30);
list_local.add("chatpati prize_local.add(30);
}
boolean list()
{
System.out.println("\n\n~*~*~*~*~*~*~*~*~*~*"+hotelName+"~*~*~*~*~*~*~*~*~*~*\n\nSystem.oSystem.out.println("_____________________W_L_O_E_________________________ System.out.println("______________________E_C_M__________________________\n\n System.out.println("....................main..Menu.......................\n\n");
go:{do
{
displayMainMenu(main_menu);
System.out.print("_Enter your choise : ");
ch = sc.nextInt();
switch(ch){
case 1:
displayMenu(list_southIndian,prize_southIndian);
break;
case 2:
displayMenu(list_gujarati,prize_gujarati);
break;
case 3:
displayMenu(list_panjabi,prize_panjabi);
break;
case 4:
displayMenu(list_chainies,prize_chainies);
break;
case 5:
displayMenu(list_tea,prize_tea);
break;
case 6:
displayMenu(list_icecream,prize_icecream);
break;
case 7:
displayMenu(list_local,prize_local);
break;
case 10:
System.out.println("Checking....");
return(true);
case 8:
System.out.println("Exit");
break;
default:
System.out.println("ine.....plz agian");
break;
}
}while(8!=ch);
return(false);
}
}
void displayMenu(ArrayList list,ArrayList prize)
{
int i=1;
boolean flag=true;
Scanner sc = new Scanner(System.in);
Iterator itr=list.iterator();
Iterator itr1=prize.iterator();
int j;
do{
while(itr.hasNext())
{
System.out.println(" "+i+" "+itr.next()+"............................."+itr1.next()+"/-"+"...");
i++;
}
j=i;
if(flag=true){
System.out.println(" "+j+". back<<");
flag=false;
}
System.out.print("Enter choise : ");
ch=sc.nextInt();
if(ch<j){
cbill+=prize.get(ch-1);
}
else
{
System.out.println("unavaible choise..........try again");
}
System.out.println("Current bill : "+cbill);
}while(ch!=j);
}
void displayMainMenu(ArrayList list)
{
int i=1;
Iterator itr1=list.iterator();
while(itr1.hasNext())
{
System.out.println(" "+i+"."+itr1.next());
i++;
}
}
void editprofile(){
Scanner sc = new Scanner(System.in);
System.out.println("_____________Edit profilr_____________");
System.out.println("1.change hotel name");
System.out.print("Enter your choise : ");
ch=sc.nextInt();
switch(ch)
{
case 1:
System.out.print("Enter new name of hotel : ");
hotelName=sc.next();
}
}
void removeitem()
{
Scanner sc = new Scanner(System.in);
boolean flag0,flag1;
String Item;
int prize;
int ch;
displayMainMenu(main_menu);
System.out.print("Which catogeory : ");
ch=sc.nextInt();
System.out.print("Enter intem name to be remove : ");
Item=sc.next();
switch(ch)
{
case 1:
int i,j;
boolean flag;
for(i=0;i<list_southIndian.size();i++)
{
flag=list_southIndian.get(i).equals(Item);
if(flag==true)
{
list_southIndian.remove(i);
prize_southIndian.remove(i);
}
}
break;
case 2:
for(i=0;i<list_gujarati.size();i++)
{
flag=list_gujarati.get(i).equals(Item);
if(flag==true)
{
list_gujarati.remove(i);
prize_gujarati.remove(i);
}
}
break;
case 3:
for(i=0;i<list_chainies.size();i++)
{
flag=list_chainies.get(i).equals(Item);
if(flag==true)
{
list_chainies.remove(i);
prize_chainies.remove(i);
}
}
break;
case 4:
for(i=0;i<list_panjabi.size();i++)
{
flag=list_panjabi.get(i).equals(Item);
if(flag==true)
{
list_panjabi.remove(i);
prize_panjabi.remove(i);
}
}
break;
case 5:
for(i=0;i<list_tea.size();i++)
{
flag=list_tea.get(i).equals(Item);
if(flag==true)
{
list_tea.remove(i);
list_tea.remove(i);
}
}
break;
case 6:
for(i=0;i<list_icecream.size();i++)
{
flag=list_icecream.get(i).equals(Item);
if(flag==true)
{
list_icecream.remove(i);
prize_icecream.remove(i);
}
}
break;
case 7:
for(i=0;i<list_local.size();i++)
{
flag=list_local.get(i).equals(Item);
if(flag==true)
{
list_local.remove(i);
prize_local.remove(i);
}
}
break;
default:
System.out.println("_______Invalid choise_______");
break;
}
}
void additem()
{
Scanner sc = new Scanner(System.in);
boolean flag;
String Item;
int prize;
int ch;
System.out.print("Enter intem name to be Add : ");
Item=sc.next();
System.out.print("Enter Prize of Item : ");
prize=sc.nextInt();
System.out.println("__________catageory____________");
System.out.println("1.South Indian");
System.out.println("2.Gujarati");
System.out.println("3.chainies");
System.out.println("4.panjabi");
System.out.println("5.tea");
System.out.println("6.icecrime");
System.out.println("7.Local of kutch");
System.out.print("Which catogeory : ");
ch=sc.nextInt();
switch(ch)
{
case 1:
list_southIndian.add(Item);
prize_southIndian.add(prize);
break;
case 2:
list_gujarati.add(Item);
prize_gujarati.add(prize);
break;
case 3:
list_chainies.add(Item);
prize_chainies.add(prize);
break;
case 4:
list_panjabi.add(Item);
prize_panjabi.add(prize);
break;
case 5:
list_icecream.add(Item);
prize_icecream.add(prize);
break;
case 6:
list_local.add(Item);
prize_local.add(prize);
break;
default:
System.out.println("_______Invalid choise1_______");
break;
}
}
}