forked from dhruba-datta/FoodOrderingSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
2013 lines (1932 loc) · 60.7 KB
/
main.cpp
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
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <iostream>
#include <string>
#include <stdlib.h>
#include <ctime>
#include <fstream>
#include <string.h>
#include <fstream>
#include <conio.h>
#include <sstream>
#define LSIZ 128
#define RSIZ 10
using namespace std;
class Customer
{
private:
string Name ;
int phone;
protected:
string tea1="MILK TEA",tea2="GINGER TEA",paratha1="PARATHA",paratha2="ALU PARATHA",dosa1="ONION DOSA",dosa2="MASALA DOSA",
idli1="RICE IDLI",idli2="RAVA IDLI",egg1="BOILED EGG",egg2="OMLET",sandwich1="CHICKEN SANDWICH",sandwich2="CLUB SANDWICH",
pizza1="PANEER PIZZA",pizza2="CHICKEN PIZZA",burger1="CHICKEN ZINGER BURGER",burger2="CLASSIC CHICKEN BURGER",biryani1="CHICKEN BIRYANI",
biryani2="MUTTON BIRYANI",friedrice1="VEG FRIED RICE",friedrice2="CHICKEN FRIED RICE",chicken1="CHICKEN CURRY",chicken2="CHICKEN MANCHURIAN",
frenchfries="FRENCH FRIES",rolls1="VEG ROLLS",rolls2="CHICKEN ROLLS",drinks1="MOUNTAIN DEW",drinks2="PEPSI",drinks3="COCA COLA";
public:
void setname()
{
cout<<"\n Please Enter Your Name: ";
std::cin.ignore();
getline(std::cin, Name);
}
void setphone()
{
cout<<"\n Enter your phone number : ";
cin>>phone;
system("CLS");
}
string getname()
{
return Name;
}
int getphone()
{
return phone;
}
};
class getData : public Customer
{
private:
int quantity,sum=0,price,t=0,time;
public:
void total(int,int);
void timetaken(int,int);
string show(int num);
int resetwaitingtime()
{
return t=0;
}
int removesum()
{
return sum=0;
}
int getsum()
{
return sum;
}
int getTime()
{
return t;
}
};
string getData::show(int num)
{
if(num==1)
{
return tea1;
}
if(num==2)
{
return tea2;
}
if(num==3)
{
return paratha1;
}
if(num==4)
{
return paratha2;
}
if(num==5)
{
return dosa1;
}
if(num==6)
{
return dosa2;
}
if(num==7)
{
return idli1;
}
if(num==8)
{
return idli2;
}
if(num==9)
{
return egg1;
}
if(num==10)
{
return egg2;
}
if(num==11)
{
return sandwich1;
}
if(num==12)
{
return sandwich2;
}
if(num==13)
{
return pizza1;
}
if(num==14)
{
return pizza2;
}
if(num==15)
{
return burger1;
}
if(num==16)
{
return burger2;
}
if(num==17)
{
return biryani1;
}
if(num==18)
{
return biryani2;
}
if(num==19)
{
return friedrice1;
}
if(num==20)
{
return friedrice2;
}
if(num==21)
{
return chicken1;
}
if(num==22)
{
return chicken2;
}
if(num==23)
{
return frenchfries;
}
if(num==24)
{
return rolls1;
}
if(num==25)
{
return rolls2;
}
if(num==26)
{
return drinks1;
}
if(num==27)
{
return drinks2;
}
if(num==28)
{
return drinks3;
}
}
void getData::total(int price,int quantity)
{
sum = sum + (price * quantity);
}
void getData::timetaken(int time,int quantity)
{
t = t + (time * quantity);
if(t>20)
t=20;
}
void current_time()
{
time_t curr_time;
curr_time = time(NULL);
char *tm = ctime(&curr_time);
cout << "Order Finishing Time : " << tm;
}
void writeFile(string CustomerName,int phonenum , string foodname, int sizeo, int quantity, int token , int coun )
{
string word;
ofstream outfile;
word = to_string(token) + ".txt";
outfile.open(word,ios_base::app);
if (coun == 0)
{
outfile<<""+ CustomerName + "- " + to_string (phonenum)<<"\n";
outfile <<""+ foodname + " - " +to_string(sizeo)+" - " + to_string(quantity) <<"\n";
}
else
{
outfile <<""+ foodname + " - " +to_string(sizeo)+" - " + to_string(quantity) <<"\n";
}
}
void readFile()
{
char line[RSIZ][LSIZ];
char fname[40];
FILE *fptr = NULL;
int i = 0;
int tot = 0;
cout << "Find out who placed order :" << endl;
cout << "-----------------------------------------------------------" << endl;
cout << "Input the filename to be opened : ";
cin >> fname;
fptr = fopen(fname, "r");
while (fgets(line[i], LSIZ, fptr))
{
line[i][strlen(line[i]) - 1] = '\0';
i++;
}
tot = i;
cout << endl;
for (i = 0; i < tot; ++i)
{
cout<<line[i]<<endl;
}
}
void deleteFile()
{
char fname[40];
char rem[40] = "del /f ";
cout << "Input the filename to be deleted : ";
cin >> fname;
system(strcat(rem,fname));
}
int main()
{
Customer name1;
getData order1;
int quantity,ch,ch1,ch2,coa,coo=0,cop,pc,change,to=1,cou=0;
string Namee= "Dhruba";
char again;
while (coo!=1)
{
head:
system("CLS");
cout<<"\n";
cout<<" || DIGITAL FOOD ORDERING SYSTEM OF A RESTAURANT || \n";
cout<<" ---------------------------------------------------------- \n\n";
cout<<"\n Hope you are having a smile on your face! \n";
cout<<"\n 1.) Are you a Customer?\n 2.) Are you an Administrator?\n 3.) Read me \n 4.) EXIT \nPlease Enter this(1/2/3/4): ";
cin>>coa;
if(coa==2)
{
haha:
system("CLS");
string pass="";
string nname;
cout<< "\t\tGive your Name and password to log in ....\n";
cout<<"\t\tGive your name : ";
cin>>nname;
cout<<"\t\tGive your password : ";
char ch;
ch = _getch();
while(ch != 13)
{
pass.push_back(ch);
cout << '*';
ch = _getch();
}
if (nname == Namee && pass == "2020")
{
hoho:
system("CLS");
cout<<"1.) See individual customer order\n2.) Total order list \n3.) Delete order \n4.) Go back to previous menu \n Enter your choice (1/2): ";
cin>>cop;
if(cop==1)
{
system("CLS");
cout<<"";
readFile();
getch();
goto hoho;
}
else if(cop==2)
{ system("CLS");
system("dir/s");
getch();
goto hoho;
}
else if (cop==3)
{
system ("CLS");
deleteFile();
cout<<"\n Order deleted \n";
getch();
}
else if(cop==4)
{
system("CLS");
goto head;
}
else
{
cout<<"wrong input ";
goto head;
}
}
else {
system("CLS");
int np;
cout<<"Invalid Name or Password ...\n";
cout<<"1.) Wanna try again ? \n2.) Go back to main menu \nChoose your option (1/2) :\n";
cin>>np;
if (np==1)
{
goto haha;
}
else
{
goto head;
}
}
}
else if(coa==1)
{
system("CLS");
int n;
cout<<"\n";
cout<<"\n 1.) Do you want to order your food?";
cout<<"\n 2.) Do you see your order?";
cout<<"\n Give your choice : ";
cin>>n;
if (n==2)
{
system("CLS");
cout<<"";
readFile();
getch();
goto head;
}
else
{
system("CLS");
cout<<"\n";
time_t curr_time1;
curr_time1 = time(NULL);
char *tm1 = ctime(&curr_time1);
cout << "Arrival Time : " << tm1;
name1.setname();
name1.setphone();
start:
system("CLS");
cout << "\nArrivalTime : " << tm1;
cout<<" ----|| WELCOME TO OUR RESTAURANT ||----\n";
cout<<"----|| HOPE YOU HAVE A SMILE ON YOUR FACE ||----\n\n";
cout<<"Hello "<<name1.getname()<<"\n";
cout<<"Phone number : "<<name1.getphone()<<endl<<endl;
cout<<"--------Food Menu--------\n\n";
cout<<"01) TEA\n"; //time take t1
cout<<"02) PARATHA\n"; //time take t2
cout<<"03) DOSA\n"; //time take t3*quantity
cout<<"04) IDLI\n"; //time take t4*quantity
cout<<"05) EGG\n"; //time take t5
cout<<"06) SANDWICH\n"; //time take t6*quantity
cout<<"07) PIZZA\n"; //time take t7*quantity
cout<<"08) BURGER\n"; //time take t8*quantity
cout<<"09) BIRYANI\n"; //time take t9
cout<<"10) FRIED RICE\n"; //time take t10
cout<<"11) CHICKEN\n"; //time take t11
cout<<"12) FRENCH FRIES\n"; //time take t12*quantity
cout<<"13) ROLLS\n"; //time take t13*quantity
cout<<"14) DRINKS\n\n"; //time take t14
cout<<"15) Do you want to see your order?\n";
cout<<"16) Go back to previous menu\n\n";
cout<<"\n Please Enter your Choice: ";
cin>>ch;
switch(ch)
{
case 1:
tea:
system("CLS");
cout<<"\nThere is 2 choices for tea:\n\n"<<"\n1)"<<order1.show(1)<<endl<<endl;
cout<<"2)"<<order1.show(2)<<endl<<endl;
cout<<"3.) Go back to main menu \n";
cout<<"\nPlease Enter your Choice: ";
cin>>ch1;
if (ch1==3)
{
goto start;
}
else if(ch1==1 || ch1==2)
{
system("CLS");
cout<<"\n1) Small Rs.50\n"<<"2) Regular Rs.80\n"<<"3) Large Rs.100\n"<<"4) Go back to Previous Menu\n ";
cout<<"\nChoose Size Please: ";
cin>>ch2;
switch(ch2)
{
case 1:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(50,quantity);
order1.timetaken(2,quantity);
break;
case 2:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(80,quantity);
order1.timetaken(2,quantity);
break;
case 3:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(100,quantity);
order1.timetaken(2,quantity);
break;
case 4:
goto tea;
default:
cout<<"\n\nPLEASE ENTER THE VALID CHOICES!!"<<endl;
break;
}
if(ch1==1)
{
writeFile(name1.getname(), name1.getphone() , order1.show(1), ch2, quantity, to , cou);
cou++;
}
else if(ch1==2)
{
writeFile(name1.getname(), name1.getphone() ,order1.show(2), ch2, quantity, to , cou );
cou++;
}
cout<<"\n DO YOU WANT TO ORDER MORE(Y|N)?: ";
cin>>again;
if(again=='Y' || again=='y')
{
goto start ;
}
else if(again=='n' || again =='N')
{
teap:
system("CLS");
int pay ;
cout<<"\nYour Total Bill is "<<order1.getsum();
cout<<"\nPay your Bill : ";
cin>>pay;
if(pay == order1.getsum())
{
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2 || ch2==3)
{to++;}
getch();
}
else if(pay>=order1.getsum())
{
change = pay - order1.getsum();
cout<<"\nYour Change: "<<change<<" Rs.";
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2 || ch2==3)
{to++;}
getch();
}
else
{
cout<<"\nPayment is insufficient ";
cout<<"\n1)Please pay sufficient amount : ";
cin>>pc;
switch(pc)
{
case 1 :
goto teap;
break;
}
}
}
else
{
cout<<"\n Invalid command! GO back to Menu and order again";
}
}
else
{
cout<<"\n\n PLEASE ENTER THE VALID CHOICES!!"<<endl;
}
system("CLS");
break;
case 2:
system("CLS");
cout<<"\nThere is 2 choices for paratha:\n\n"<<"\n1)"<<order1.show(3)<<endl<<endl;
cout<<"2)"<<order1.show(4)<<endl<<endl;
cout<<"3) Go to previous menu \n";
cout<<"\nPlease Enter your Choice: ";
cin>>ch2;
switch(ch2)
{
case 1:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(10,quantity);
order1.timetaken(5,quantity);
break;
case 2:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(30,quantity);
order1.timetaken(5,quantity);
break;
case 3 :
goto start ;
default:
cout<<"\n\n PLEASE ENTER THE VALID CHOICES!!"<<endl;
break;
}
if(ch2==1)
{
writeFile(name1.getname(), name1.getphone(), order1.show(3), ch2, quantity, to, cou );
cou++;
}
else if(ch2==2)
{
writeFile(name1.getname(), name1.getphone(), order1.show(4), ch2, quantity, to, cou );
cou++;
}
cout<<"\n DO YOU WANT TO ORDER MORE(Y|N)?: ";
cin>>again;
if(again=='Y' || again=='y')
{
goto start ;
}
else if(again=='n' || again =='N')
{
parap:
system("CLS");
int pay ;
cout<<"\nYour Total Bill is "<<order1.getsum();
cout<<"\nPay your Bill : ";
cin>>pay;
if(pay == order1.getsum())
{
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else if(pay>=order1.getsum())
{
change = pay - order1.getsum();
cout<<"\nYour Change: "<<change<<" Rs.";
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else
{
cout<<"\nPayment is insufficient ";
cout<<"\n1)Please pay sufficient ammount : ";
cin>>pc;
switch(pc)
{
case 1 :
goto parap;
break;
}
}
}
else
{
cout<<"\n Invalid command! GO back to Menu and order again";
}
system("CLS");
break;
case 3:
system("CLS");
cout<<"\nThere is 2 choices for dosa:\n\n"<<"\n1)"<<order1.show(5)<<endl<<endl;
cout<<"2)"<<order1.show(6)<<endl<<endl;
cout<<"3) Go back to main menu \n";
cout<<"\nPlease Enter your Choice: ";
cin>>ch2;
switch(ch2)
{
case 1:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(30,quantity);
order1.timetaken(7,quantity);
break;
case 2:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(50,quantity);
order1.timetaken(7,quantity);
break;
case 3:
goto start;
default:
cout<<"\n\n PLEASE ENTER THE VALID CHOICES!!"<<endl;
break;
}
if(ch2==1)
{
writeFile(name1.getname(), name1.getphone(), order1.show(5), ch2, quantity, to, cou);
cou++;
}
else if(ch2==2)
{
writeFile(name1.getname(), name1.getphone(), order1.show(6), ch2, quantity, to, cou);
cou++;
}
cout<<"\n DO YOU WANT TO ORDER MORE(Y|N)?: ";
cin>>again;
if(again=='Y' || again=='y')
{
goto start ;
}
else if(again=='n' || again =='N')
{
dosap:
system("CLS");
int pay ;
cout<<"\nYour Total Bill is "<<order1.getsum();
cout<<"\nPay your Bill : ";
cin>>pay;
if(pay == order1.getsum())
{
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else if(pay>=order1.getsum())
{
change = pay - order1.getsum();
cout<<"\nYour Change: "<<change<<" Rs.";
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else
{
cout<<"\nPayment is insufficient ";
cout<<"\n1)Please pay sufficient ammount : ";
cin>>pc;
switch(pc)
{
case 1 :
goto dosap;
break;
}
}
}
else
{
cout<<"\n Invalid command! GO back to Menu and order again";
}
system("CLS");
break;
case 4:
system("CLS");
cout<<"\nThere is 2 choices for Idli:\n\n"<<"\n1)"<<order1.show(7)<<endl<<endl;
cout<<"2)"<<order1.show(8)<<endl<<endl;
cout<<"3) Go back to main menu \n";
cout<<"\nPlease Enter your Choice: ";
cin>>ch2;
switch(ch2)
{
case 1:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(30,quantity);
order1.timetaken(8,quantity);
break;
case 2:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(50,quantity);
order1.timetaken(8,quantity);
break;
case 3 :
goto start ;
default:
cout<<"\n\n PLEASE ENTER THE VALID CHOICES!!"<<endl;
break;
}
if(ch2==1)
{
writeFile(name1.getname(), name1.getphone(), order1.show(7), ch2, quantity, to, cou);
cou++;
}
else if(ch2==2)
{
writeFile(name1.getname(), name1.getphone(), order1.show(8), ch2, quantity, to, cou);
cou++;
}
cout<<"\n DO YOU WANT TO ORDER MORE(Y|N)?: ";
cin>>again;
if(again=='Y' || again=='y')
{
goto start ;
}
else if(again=='n' || again =='N')
{
idlip:
system("CLS");
int pay ;
cout<<"\nYour Total Bill is "<<order1.getsum();
cout<<"\nPay your Bill : ";
cin>>pay;
if(pay == order1.getsum())
{
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else if(pay>=order1.getsum())
{
change = pay - order1.getsum();
cout<<"\nYour Change: "<<change<<" Rs.";
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else
{
cout<<"\nPayment is insufficient ";
cout<<"\n1)Please pay sufficient ammount : ";
cin>>pc;
switch(pc)
{
case 1 :
goto idlip;
break;
}
}
}
else
{
cout<<"\n Invalid command! GO back to Menu and order again";
}
system("CLS");
break;
case 5:
system("CLS");
cout<<"\nThere is 2 choices for eggs:\n\n"<<"\n1)"<<order1.show(9)<<endl<<endl;
cout<<"2)"<<order1.show(10)<<endl<<endl;
cout<<"3) Go back to main menu \n";
cout<<"\nPlease Enter your Choice: ";
cin>>ch2;
switch(ch2)
{
case 1:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(20,quantity);
order1.timetaken(5,quantity);
break;
case 2:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(30,quantity);
order1.timetaken(5,quantity);
break;
case 3:
goto start ;
default:
cout<<"\n\n PLEASE ENTER THE VALID CHOICES!!"<<endl;
break;
}
if(ch2==1)
{
writeFile(name1.getname(), name1.getphone(), order1.show(9), ch2, quantity, to, cou);
cou++;
}
else if(ch2==2)
{
writeFile(name1.getname(), name1.getphone(), order1.show(10), ch2, quantity, to, cou);
cou++;
}
cout<<"\n DO YOU WANT TO ORDER MORE(Y|N)?: ";
cin>>again;
if(again=='Y' || again=='y')
{
goto start ;
}
else if(again=='n' || again =='N')
{
eggp:
system("CLS");
int pay ;
cout<<"\nYour Total Bill is "<<order1.getsum();
cout<<"\nPay your Bill : ";
cin>>pay;
if(pay == order1.getsum())
{
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else if(pay>=order1.getsum())
{
change = pay - order1.getsum();
cout<<"\nYour Change: "<<change<<" Rs.";
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}
else
{
cout<<"\nPayment is insufficient ";
cout<<"\n1)Please pay sufficient ammount : ";
cin>>pc;
switch(pc)
{
case 1 :
goto eggp;
break;
}
}
}
else
{
cout<<"\n Invalid command! GO back to Menu and order again";
}
system("CLS");
break;
case 6:
system("CLS");
cout<<"\nThere is 2 choices for Sandwich:\n\n"<<"\n1)"<<order1.show(11)<<endl<<endl;
cout<<"2)"<<order1.show(12)<<endl<<endl;
cout<<"3) Go back to main menu \n";
cout<<"\nPlease Enter your Choice: ";
cin>>ch2;
switch(ch2)
{
case 1:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(50,quantity);
order1.timetaken(10,quantity);
break;
case 2:
cout<<"\nPlease Enter Quantity: ";
cin>>quantity;
order1.total(60,quantity);
order1.timetaken(10,quantity);
break;
case 3 :
goto start;
default:
cout<<"\n\n PLEASE ENTER THE VALID CHOICES!!"<<endl;
break;
}
if(ch2==1)
{
writeFile(name1.getname(), name1.getphone(), order1.show(11), ch2, quantity, to, cou);
cou++;
}
else if(ch2==2)
{
writeFile(name1.getname(), name1.getphone(), order1.show(12), ch2, quantity, to, cou);
cou++;
}
cout<<"\n DO YOU WANT TO ORDER MORE(Y|N)?: ";
cin>>again;
if(again=='Y' || again=='y')
{
goto start ;
}
else if(again=='n' || again =='N')
{
sandwichp:
system("CLS");
int pay ;
cout<<"\nYour Total Bill is "<<order1.getsum();
cout<<"\nPay your Bill : ";
cin>>pay;
if(pay == order1.getsum())
{
cout<<"\nYour Order Will be delivered in "<<order1.getTime()<<" Minutes";
cout<<"\n\nYour token number is : "<<to;
cout<<"\nThank you For Ordering\n\n\n\n";
cout << "ArrivalTime : " << tm1;
current_time();
if(ch2==1 || ch2==2)
{to++;}
getch();
}