-
Notifications
You must be signed in to change notification settings - Fork 0
/
Resturant.cpp
109 lines (91 loc) · 2.05 KB
/
Resturant.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
#include "Resturant.h"
Resturant::Resturant(Menu *men)
{
menu=men;
orders=new Order*[100000];
num_oforders=0;
}
void Resturant::select_event()
{
int i;
while(true)
{
cout<<"Do you want to ... "<<endl;
cout <<" <1> View the menu?"<<endl;
cout <<" <2> Make an order?"<<endl;
cout <<" <3> View orders?"<<endl;
cout <<" <4> Serve an order?"<<endl;
cout <<" <5> Exit?"<<endl;
cout<<"Enter your choice : ";
cin>>i;
if(i==1)
viewmenu();
if(i==2)
addorder();
if(i==3)
vieworders();
if(i==4)
serveorder();
if(i==5)
{
cout <<"________________________________________________________________"<<endl<<endl;
cout<<"Ending the program ......."<<endl;
cout <<"________________________________________________________________"<<endl<<endl;
break;
}
}
}
void Resturant::addorder()
{
orders[num_oforders]=new Order(menu);
orders[num_oforders]->readinfo();
orders[num_oforders]->displayinfo();
num_oforders++;
}
void Resturant::vieworders()
{
bool check=false;
for(int i=0;i<num_oforders;i++)
{
if(orders[i]!=NULL)
{
orders[i]->displayinfo();
check=true;
}
}
if(!check)
{
cout <<"________________________________________________________________"<<endl<<endl;
cout<<"You don't have bending orders"<<endl;
cout <<"________________________________________________________________"<<endl<<endl;
}
}
void Resturant::serveorder()
{
int id;bool check=false;
cout <<"________________________________________________________________"<<endl<<endl;
cout<<"Please enter the order ID : ";
cin>>id;
if(orders[id-1]!=NULL)
{
cout<<"Serving Order #"<<id<<" for Customer "<<orders[id-1]->get_customername()<<endl;
cout <<"________________________________________________________________"<<endl<<endl;
check=true;
delete orders[id-1];
orders[id-1]=NULL;
}
if(!check)
cout<<"You don't have bending orders"<<endl;
}
void Resturant::viewmenu()
{
menu->displayinfo();
}
Resturant::~Resturant(void)
{
for(int i=0;i<num_oforders;i++)
{
delete orders[i];
}
delete[]orders;
}