-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrder.cpp
49 lines (39 loc) · 863 Bytes
/
Order.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
#include "Order.h"
Order::Order() : _id(0), _status(Status::Cooking) { }
std::vector<Pizza> Order::GetPizzas() {
return _pizzas;
}
void Order::Complete() {
_status = Status::Ready;
}
void Order::AddPizza(Pizza pizza) {
_pizzas.push_back(pizza);
}
Status Order::GetStatus() const {
return _status;
}
void Order::SetStatus(Status status) {
_status = status;
}
int Order::CalculateCost() const {
int cost = 0;
for (const Pizza& pizza : _pizzas) {
cost += pizza.CalculateCost();
}
return cost;
}
bool Order::operator==(const Order& other) const {
if (this->_id != other._id)
return false;
if (this->_status != other._status)
return false;
if (this->_pizzas != other._pizzas)
return false;
return true;
}
void Order::SetId(int id) {
_id = id;
}
int Order::GetId() const {
return _id;
}