-
Notifications
You must be signed in to change notification settings - Fork 0
/
Table.h
67 lines (45 loc) · 1.28 KB
/
Table.h
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
#ifndef TABLE_H
#define TABLE_H
#include <iostream>
#include <queue>
#include <stack>
#include <unordered_map>
#include "Dish.h"
using std::string;
class Table{
public:
explicit Table();
bool isAvailable() const;
bool seatCustomer();
double getCurrentBill() const;
double getFinalBill();
void orderDish(Dish* dish);
void getCredit(double credit);
private:
bool _available;
std::queue<Dish*> _orders;
double _bill;
};
class Tables{
public:
explicit Tables(int capacity);
// increase capacity by factor: new_capacity = old_capacity + factor (factor can not be negative)
void increaseCapacity(int factor);
unsigned int getNumOfCustomer() const;
unsigned int getNumOfAvailableTables() const;
// return -1 if all tables are busy
unsigned int seatCustomer();
double getFinalBill(unsigned int num);
double getCurrentBill(int num) const;
void giveCredit(int num, double credit);
bool orderDish(int num_table, Dish* dish);
unsigned int getCapacity() const;
unsigned int getTotalNumberOfCustomers() const;
double getMostExpensiveBill() const;
private:
std::unordered_map<int, Table> _tables;
std::stack<int> _available;
unsigned int _customers;
double _expensive;
};
#endif //TABLE_H