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

Commit 7347f75

Browse files
committed
Hotfix
1 parent 63dabf8 commit 7347f75

Some content is hidden

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

69 files changed

+77
-34
lines changed

AddOn.o

-56 Bytes
Binary file not shown.

Bake.o

-64 Bytes
Binary file not shown.

Bar.o

-64 Bytes
Binary file not shown.

Bartender.o

-56 Bytes
Binary file not shown.

Base.o

-64 Bytes
Binary file not shown.

Boil.o

-56 Bytes
Binary file not shown.

Builder.o

-64 Bytes
Binary file not shown.

BusyState.o

-64 Bytes
Binary file not shown.

Cash.o

-56 Bytes
Binary file not shown.

Chef.o

-64 Bytes
Binary file not shown.

Cocktail.o

-56 Bytes
Binary file not shown.

CocktailMixer.o

-56 Bytes
Binary file not shown.

CocktailOrder.o

-56 Bytes
Binary file not shown.

CocktailOrderDetail.o

-64 Bytes
Binary file not shown.

ColdDessert.o

-56 Bytes
Binary file not shown.

Command.o

-64 Bytes
Binary file not shown.

ConcreteChefCreator.o

-64 Bytes
Binary file not shown.

CreditCard.o

-56 Bytes
Binary file not shown.

Customer.o

-56 Bytes
Binary file not shown.

DessertChef.o

-64 Bytes
Binary file not shown.

DessertMenu.o

-56 Bytes
Binary file not shown.

DessertOrder.o

-56 Bytes
Binary file not shown.

DessertOrderBuilder.o

-56 Bytes
Binary file not shown.

Factory.o

-64 Bytes
Binary file not shown.

Floor.o

-64 Bytes
Binary file not shown.

FreeState.o

-64 Bytes
Binary file not shown.

Fruit.o

-56 Bytes
Binary file not shown.

Fry.o

-56 Bytes
Binary file not shown.

Grill.o

-56 Bytes
Binary file not shown.

HeadChef.o

-56 Bytes
Binary file not shown.

High.o

-56 Bytes
Binary file not shown.

HotDessert.o

-56 Bytes
Binary file not shown.

Ice.o

-56 Bytes
Binary file not shown.

Individual.o

-56 Bytes
Binary file not shown.

Kitchen.o

-56 Bytes
Binary file not shown.

Low.o

-56 Bytes
Binary file not shown.

Main

1.73 KB
Binary file not shown.

Main.o

-56 Bytes
Binary file not shown.

MainChef.o

-56 Bytes
Binary file not shown.

MainMenu.o

-64 Bytes
Binary file not shown.

MainOrder.o

-56 Bytes
Binary file not shown.

MainOrderBuilder.o

-56 Bytes
Binary file not shown.

Manager.o

-64 Bytes
Binary file not shown.

MealBuilder.o

-56 Bytes
Binary file not shown.

MealProduct.o

-56 Bytes
Binary file not shown.

Medium.o

-64 Bytes
Binary file not shown.

Menu.o

-56 Bytes
Binary file not shown.

NoCook.o

-56 Bytes
Binary file not shown.

Order.o

-56 Bytes
Binary file not shown.

OrderFactory.o

-64 Bytes
Binary file not shown.

Salad.o

-56 Bytes
Binary file not shown.

Satisfaction.o

-56 Bytes
Binary file not shown.

Saute.o

-56 Bytes
Binary file not shown.

Simmer.o

-56 Bytes
Binary file not shown.

SimpleOrder.o

-56 Bytes
Binary file not shown.

Staff.o

-56 Bytes
Binary file not shown.

StarterChef.o

-56 Bytes
Binary file not shown.

StarterMenu.o

-64 Bytes
Binary file not shown.

StarterOrder.o

-56 Bytes
Binary file not shown.

StarterOrderBuilder.o

-64 Bytes
Binary file not shown.

Sushi.o

-56 Bytes
Binary file not shown.

Table.o

-64 Bytes
Binary file not shown.

Type.o

-64 Bytes
Binary file not shown.

UI.cpp

+77-34
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <string>
33
#include <iostream>
44
#include <vector>
5+
#include <limits>
56
using namespace std;
67

78
UI::UI(concreteCommand *c, Floor *f)
@@ -14,7 +15,6 @@ UI::UI(concreteCommand *c, Floor *f)
1415
b1->setBuilder(cm1);
1516
bar_ = new Bar();
1617
bar_->setBarTender(b1);
17-
1818
}
1919

2020
UI::~UI()
@@ -30,52 +30,95 @@ void UI::addCustomer()
3030
cout << endl;
3131
int size;
3232

33-
if (!(cin >> size))
33+
while (!(cin >> size) || (size != 1 && size != 2))
3434
{
35-
cout << "Input is not a number. Try again." << endl;
36-
cin >> size;
35+
cin.clear(); // clear the error flags
36+
cin.ignore(numeric_limits<streamsize>::max(), '\n'); // ignore the rest of the line
37+
cout << "Invalid input. Please enter 1 for Single or 2 for Group." << endl;
3738
}
39+
// if (size == 1)
40+
// {
41+
// Customer *single = c1->produceCustomer('!');
42+
// // c1->seatCustomer(single);
43+
// }
44+
// else
45+
// {
46+
// if (size == 2)
47+
// {
48+
// cout << "Enter your group's size: " << endl;
49+
// int gSize;
50+
// cin >> gSize;
51+
52+
// vector<Customer *> tempVec;
53+
// int x;
54+
// int y;
55+
// pair<int, int> option = c1->reserveGroupTable();
56+
// x = option.first;
57+
// y = option.second;
58+
// for (int i = 0; i < gSize; i++)
59+
// {
60+
// tempVec.push_back(c1->produceCustomer(c1->getGroupID()));
61+
// }
62+
// cout << "x " << x << " y " << y << endl;
63+
// int counter = 1;
64+
// for (Customer *customer : tempVec)
65+
// {
66+
// cout << "Seating customer: " << counter << endl;
67+
// c1->seatMultipleCustomers(x, y, customer);
68+
// counter++;
69+
// }
70+
// c1->setGroupID();
71+
// }
72+
73+
// else
74+
// {
75+
// if (size != 1 || size != 2)
76+
// cout << "Invalid input, moving forward as single" << endl;
77+
// Customer *single = c1->produceCustomer('!');
78+
// return;
79+
// }
80+
// }
3881
if (size == 1)
3982
{
4083
Customer *single = c1->produceCustomer('!');
4184
// c1->seatCustomer(single);
4285
}
43-
else
86+
else if (size == 2)
4487
{
45-
if (size == 2)
88+
cout << "Enter your group's size: " << endl;
89+
int gSize;
90+
while (!(cin >> gSize) || gSize <= 0)
4691
{
47-
cout << "Enter your group's size: " << endl;
48-
int gSize;
49-
cin >> gSize;
50-
51-
vector<Customer *> tempVec;
52-
int x;
53-
int y;
54-
pair<int, int> option = c1->reserveGroupTable();
55-
x = option.first;
56-
y = option.second;
57-
for (int i = 0; i < gSize; i++)
58-
{
59-
tempVec.push_back(c1->produceCustomer(c1->getGroupID()));
60-
}
61-
cout << "x " << x << " y " << y << endl;
62-
int counter = 1;
63-
for (Customer *customer : tempVec)
64-
{
65-
cout << "Seating customer: " << counter << endl;
66-
c1->seatMultipleCustomers(x, y, customer);
67-
counter++;
68-
}
69-
c1->setGroupID();
92+
cin.clear();
93+
cin.ignore(numeric_limits<streamsize>::max(), '\n');
94+
cout << "Invalid input. Please enter a positive number." << endl;
7095
}
7196

72-
else
97+
vector<Customer *> tempVec;
98+
int x;
99+
int y;
100+
pair<int, int> option = c1->reserveGroupTable();
101+
x = option.first;
102+
y = option.second;
103+
for (int i = 0; i < gSize; i++)
73104
{
74-
if (size != 1 || size != 2)
75-
cout << "Invalid input, moving forward as single" << endl;
76-
Customer *single = c1->produceCustomer('!');
77-
return;
105+
tempVec.push_back(c1->produceCustomer(c1->getGroupID()));
78106
}
107+
cout << "x " << x << " y " << y << endl;
108+
int counter = 1;
109+
for (Customer *customer : tempVec)
110+
{
111+
cout << "Seating customer: " << counter << endl;
112+
c1->seatMultipleCustomers(x, y, customer);
113+
counter++;
114+
}
115+
c1->setGroupID();
116+
}
117+
else
118+
{
119+
cout << "Invalid input, moving forward as single" << endl;
120+
Customer *single = c1->produceCustomer('!');
121+
// c1->seatCustomer(single);
79122
}
80123
}
81124

UI.o

3.96 KB
Binary file not shown.

Waiter.o

-56 Bytes
Binary file not shown.

concreteCommand.o

-64 Bytes
Binary file not shown.

customerFactory.o

-56 Bytes
Binary file not shown.

maitreD.o

-64 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)