Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 63dabf8

Browse files
committed
The final working Restaurant
1 parent 25fd3c0 commit 63dabf8

File tree

221 files changed

+6628
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+6628
-0
lines changed

AddOn.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "AddOn.h"
2+
#include <string>
3+
#include <vector>
4+
using namespace std;
5+
6+
AddOn::AddOn()
7+
{
8+
this->nextItem = NULL;
9+
}
10+
11+
AddOn::AddOn(CocktailOrder *nextItem)
12+
{
13+
this->nextItem = nextItem;
14+
}
15+
16+
void AddOn::setNextItem(CocktailOrder *nI)
17+
{
18+
this->nextItem = nI;
19+
}
20+
21+
AddOn *AddOn::sp()
22+
{
23+
return this;
24+
}

AddOn.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pragma once
2+
#include <string>
3+
#include <iostream>
4+
#include "CocktailOrder.h"
5+
using namespace std;
6+
7+
class AddOn : public CocktailOrder
8+
{
9+
public:
10+
CocktailOrder *nextItem;
11+
AddOn();
12+
AddOn(CocktailOrder *nextItem);
13+
void addInfo(string x) = 0;
14+
void addDetail(int ID) = 0;
15+
void setNextItem(CocktailOrder *nI);
16+
AddOn *sp();
17+
};

AddOn.o

82.9 KB
Binary file not shown.

Bake.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "CookingStrategy.h"
2+
Bake::Bake() {}
3+
4+
Bake::~Bake() {}
5+
6+
std::string Bake::cookMeal(std::string prepMethod)
7+
{
8+
return "Baked ";
9+
}

Bake.o

91 KB
Binary file not shown.

Bar.cpp

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
#include "Bar.h"
2+
#include <string>
3+
#include <vector>
4+
using namespace std;
5+
6+
Bar::Bar()
7+
{
8+
this->b1 = new Bartender();
9+
}
10+
11+
Bar::~Bar()
12+
{
13+
delete this->b1;
14+
}
15+
16+
void Bar::setBarTender(Bartender *b)
17+
{
18+
this->b1 = b;
19+
}
20+
21+
void Bar::placeCocktailOrder()
22+
{
23+
string base;
24+
string type;
25+
string ice;
26+
string fruit;
27+
cout << "Choose a base: " << endl;
28+
cout << "1. Rum" << endl
29+
<< "2. Vodka" << endl
30+
<< "3. Gin";
31+
cout << endl;
32+
33+
int choice1;
34+
cin >> choice1;
35+
36+
switch (choice1)
37+
{
38+
case 1:
39+
base = "Rum";
40+
break;
41+
case 2:
42+
base = "Vodka";
43+
break;
44+
case 3:
45+
base = "Gin";
46+
break;
47+
default:
48+
cout << "Invalid choice" << endl;
49+
break;
50+
}
51+
cout << endl;
52+
cout << "Choose a type: " << endl
53+
<< "1. Shaken" << endl
54+
<< "2. Stirred" << endl;
55+
cout << endl;
56+
int choice2;
57+
cin >> choice2;
58+
59+
switch (choice2)
60+
{
61+
case 1:
62+
type = "Shaken";
63+
break;
64+
case 2:
65+
type = "Stirred";
66+
break;
67+
default:
68+
cout << "Invalid choice" << endl;
69+
break;
70+
}
71+
72+
cout << "How would you like your ice? " << endl
73+
<< "1. Crushed" << endl
74+
<< "2. Cubed" << endl
75+
<< "3. No Ice" << endl;
76+
cout << endl;
77+
78+
int choice3;
79+
cin >> choice3;
80+
81+
switch (choice3)
82+
{
83+
case 1:
84+
ice = "Crushed";
85+
break;
86+
case 2:
87+
ice = "Cubed";
88+
break;
89+
case 3:
90+
ice = "No ";
91+
break;
92+
default:
93+
cout << "Invalid choice" << endl;
94+
break;
95+
}
96+
97+
cout << "What fruit would you like to add on the side?" << endl
98+
<< "1. Cherry" << endl
99+
<< "2. Orange Slices" << endl
100+
<< "3. Blueberry" << endl;
101+
cout << endl;
102+
int choice4;
103+
cin >> choice4;
104+
105+
switch (choice4)
106+
{
107+
case 1:
108+
fruit = "Cherries";
109+
break;
110+
case 2:
111+
fruit = "Orange Slices";
112+
break;
113+
case 3:
114+
fruit = "Blueberries";
115+
break;
116+
default:
117+
cout << "Invalid choice" << endl;
118+
break;
119+
}
120+
121+
Base *baseO = new Base(base);
122+
Type *typeO = new Type(type);
123+
Ice *iceO = new Ice(ice);
124+
Fruit *fruitO = new Fruit(fruit);
125+
baseO->setNextItem(typeO);
126+
typeO->setNextItem(iceO);
127+
iceO->setNextItem(fruitO);
128+
b1->mix(baseO);
129+
serve();
130+
}
131+
132+
Cocktail *Bar::serve()
133+
{
134+
this->b1->getDrink()->printCocktail();
135+
return this->b1->getDrink();
136+
}

Bar.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#pragma once
2+
#include "CocktailOrder.h"
3+
#include "AddOn.h"
4+
#include "Base.h"
5+
#include "Type.h"
6+
#include "Ice.h"
7+
#include "Fruit.h"
8+
#include "Bartender.h"
9+
#include <string>
10+
#include <iostream>
11+
using namespace std;
12+
13+
class Bar
14+
{
15+
private:
16+
/* data */
17+
Bartender *b1;
18+
public:
19+
Bar();
20+
~Bar();
21+
void setBarTender(Bartender *b);
22+
void placeCocktailOrder();
23+
Cocktail *serve();
24+
};
25+
26+

Bar.o

96.4 KB
Binary file not shown.

Bartender.cpp

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#include "Bartender.h"
2+
#include <string>
3+
#include <vector>
4+
using namespace std;
5+
6+
Bartender::Bartender()
7+
{
8+
this->b1 = new CocktailMixer();
9+
}
10+
11+
Bartender::~Bartender()
12+
{
13+
delete this->b1;
14+
}
15+
16+
void Bartender::mix(CocktailOrder *C)
17+
{
18+
string base;
19+
string type;
20+
string ice;
21+
string fruit;
22+
23+
CocktailOrder *current = C;
24+
while (current != nullptr)
25+
{
26+
if (current->type == "Base")
27+
{
28+
base = current->name;
29+
}
30+
else if (current->type == "Type")
31+
{
32+
type = current->name;
33+
}
34+
else if (current->type == "Ice")
35+
{
36+
ice = current->name;
37+
}
38+
else if (current->type == "Fruit")
39+
{
40+
fruit = current->name;
41+
}
42+
43+
if (dynamic_cast<AddOn *>(current) != nullptr)
44+
{
45+
current = dynamic_cast<AddOn *>(current)->nextItem;
46+
}
47+
else
48+
{
49+
current = nullptr;
50+
}
51+
}
52+
53+
b1->setBase(base);
54+
b1->setType(type);
55+
b1->setIce(ice);
56+
b1->setFruit(fruit);
57+
}
58+
59+
Cocktail *Bartender::getDrink()
60+
{
61+
return b1->getProduct();
62+
}
63+
64+
void Bartender::setBuilder(Builder *b)
65+
{
66+
this->b1 = b;
67+
}

Bartender.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#pragma once
2+
#include <string>
3+
#include <iostream>
4+
#include "Cocktail.h"
5+
#include "CocktailMixer.h"
6+
#include "Builder.h"
7+
#include "CocktailOrder.h"
8+
#include "AddOn.h"
9+
#include "CocktailOrderDetail.h"
10+
using namespace std;
11+
12+
class Bartender
13+
{
14+
private:
15+
Builder *b1;
16+
17+
public:
18+
Bartender();
19+
~Bartender();
20+
void mix(CocktailOrder *C);
21+
Cocktail *getDrink();
22+
void setBuilder(Builder *b);
23+
};

Bartender.o

92.9 KB
Binary file not shown.

Base.cpp

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "Base.h"
2+
#include <string>
3+
#include <vector>
4+
using namespace std;
5+
6+
Base::Base() : AddOn()
7+
{
8+
this->type = "Base";
9+
}
10+
11+
Base::Base(string x)
12+
{
13+
this->type = "Base";
14+
this->name = x;
15+
}
16+
17+
void Base::addInfo(string x)
18+
{
19+
this->name = x;
20+
}
21+
22+
void Base::addDetail(int ID)
23+
{
24+
}

Base.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
#include <string>
3+
#include <iostream>
4+
#include "AddOn.h"
5+
using namespace std;
6+
7+
class Base : public AddOn
8+
{
9+
public:
10+
Base();
11+
Base(string x);
12+
void addInfo(string x);
13+
void addDetail(int ID);
14+
};

Base.o

89.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)