-
Notifications
You must be signed in to change notification settings - Fork 1
/
parking.h
77 lines (73 loc) · 1.63 KB
/
parking.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
68
69
70
71
72
73
74
75
76
77
#ifndef PARKING_H_
#define PARKING_H_
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<deque>
#include<QString>
#include<QStandardItemModel>
#include<QTableView>
#include<QTextBrowser>
#include<QTableWidget>
#include<QLabel>
#include<QFont>
using namespace std;
const int MAX_CAR = 2;
class Car
{
string id;
vector<int> enterTime, leaveTime, parkedPlace;
vector<double> costMoney;
int parkingPlace;
public:
Car();
Car(const string&);
void enter(int, int);
void leave(int);
double cost(int, int) const;
int getPlace() const{ return parkingPlace; }
string getNumber() const{ return id; }
double lastFee() const{ return costMoney[costMoney.size() - 1]; }
void showRecord() const;
void reset();
};
class Parking
{
Car parking[MAX_CAR + 1];
int occupiedPlaces = 0;
public:
Parking(){};
bool isFull() const;
void enterPar(Car&, int);
void remove(int);
bool findCar(const string&, bool) const;
void show(QStandardItemModel* model) const;
};
class Passageway
{
deque<Car*> passageway;
public:
void enterWay(Car*);
void leaveWay();
Car* getFront() const;
int countCar() const;
bool findCar(const string&, bool) const;
void show(QTextBrowser*) const;
};
class System
{
Parking par;
Passageway pas;
double earnings = 0;
public:
System(){};
void enterParking(Car&, int);
void leaveParking(Car&, int);
void enterPassageway(Car&);
void passToPark(int);
void showCar(const string&) const;
//void showEarnings() const;
void showCondition(QStandardItemModel*, QTextBrowser*) const;
};
#endif