This repository has been archived by the owner on Oct 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
seat.cpp
80 lines (55 loc) · 2.18 KB
/
seat.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
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
78
79
#include "seat.h"
using std::to_string;
Seat::Seat(int line, int chair, int basePrice)
: line(line), chair(chair), base_price(basePrice) {}
MainHallSeat::MainHallSeat(int line, int chair, int basePrice)
: Seat(line, chair, basePrice+100) {}
RegularSeat::RegularSeat(char area, int line, int chair, int basePrice)
: area(area), MainHallSeat(line, chair, basePrice) {}
string Seat::getLocation(const string class_name, char area) const {
//Middle-> area: D, line: 30, chair: 15
string result= class_name + "-> ";
if(area)
result+= "area: " + string(1, area) + ", ";
result += "line: " + to_string(line) + ", chair: " + to_string(chair);
return result;
}
int Seat::price() const{
return base_price;
}
GreenRoomSeat::GreenRoomSeat(int line, int chair):
Seat(line, chair, 0) {}
string GreenRoomSeat::location() const{
return getLocation("Green Room");
}
NoPrice::NoPrice() : runtime_error("Not For Sale !"){}
int GreenRoomSeat::price() const {
throw NoPrice();
}
FrontRegularSeat::FrontRegularSeat(char area, int line, int chair, int basePrice)
: RegularSeat(area, line, chair, basePrice+500) {}
string FrontRegularSeat::location() const{
return getLocation("Front",area);
}
MiddleRegularSeat::MiddleRegularSeat(char area, int line, int chair, int basePrice)
: RegularSeat(area, line, chair, basePrice+250) {}
string MiddleRegularSeat::location() const{
return getLocation("Middle",area);
}
RearRegularSeat::RearRegularSeat(char area, int line, int chair, int basePrice)
: RegularSeat(area, line, chair, basePrice) {}
string RearRegularSeat::location() const {
return getLocation("Rear",area);
}
SpecialSeat::SpecialSeat(int line, int chair, int basePrice):
MainHallSeat(line, chair, basePrice+300) {}
GoldenCircleSeat::GoldenCircleSeat(int line, int chair, int basePrice)
: SpecialSeat(line, chair, basePrice+1000) {}
string GoldenCircleSeat::location() const {
return getLocation("Golden Circle");
}
DisablePodiumSeat::DisablePodiumSeat(int line, int chair, int basePrice)
: SpecialSeat(line, chair, -200) {} //200
string DisablePodiumSeat::location() const {
return getLocation("Disable Podium");
}