-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
101 lines (77 loc) · 3.14 KB
/
main.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <iostream>
#include <memory>
#include "./seats/Seat.cpp"
#include "./screen/ScreenHall.cpp"
#include "./screen/ScreenHallBuilder.cpp"
#include "./show/ShowTime.cpp"
#include "./show/Show.cpp"
#include "./show/ShowPlannerImpl.cpp"
#include "./payment/PaymentTypes.cpp"
#include "./payment/PaymentManager.cpp"
#include "Movie.cpp"
#include "City.cpp"
#include "Theater.cpp"
#include "Ticket.cpp"
#include "BookingManager.cpp"
using namespace std;
int main()
{
// Create few Movie objects
Movie inception(1, "Inception");
Movie batman(2, "Batman");
City newyork(1, "New York");
City toronto(2, "Toronto");
shared_ptr<Theater> cineplex = make_shared<Theater>(1, "Cineplex", "Downtown, Toronto");
shared_ptr<Theater> cinepolis = make_shared<Theater>(2, "Cinepolis", "Downtown, New York");
shared_ptr<IScreenHall> cineplex_hall1 = ScreenHallBuilder(101)
.addRow(SeatType::Gold, "A", 1, 10)
.addRow(SeatType::Gold, "B", 1, 10)
.addRow(SeatType::Silver, "C", 1, 10)
.addRow(SeatType::Silver, "D", 1, 10)
.build();
shared_ptr<IScreenHall> cineplex_hall2 = ScreenHallBuilder(102)
.addRow(SeatType::Vip, "A", 1, 8)
.addRow(SeatType::Premium, "B", 1, 10)
.addRow(SeatType::Executive, "C", 1, 10)
.addRow(SeatType::Executive, "D", 1, 10)
.addRow(SeatType::Standard, "D", 1, 10)
.build();
cineplex->addScreenHall(cineplex_hall1);
cineplex->addScreenHall(cineplex_hall2);
ShowTime morning(10, 0, 120);
ShowTime afternoon(12, 30, 150);
ShowTime evening(18, 0, 120);
ShowTime night(20, 30, 150);
shared_ptr<IShow> incp_cine_h1_morn = ShowPlannerImpl(1001, morning, inception, cineplex_hall1)
.updateShowPrice(SeatType::Gold, 20)
.updateShowPrice(SeatType::Silver, 15)
.create();
shared_ptr<IShow> batman_cine_h2_night = ShowPlannerImpl(1002, night, batman, cineplex_hall2)
.updateShowPrice(SeatType::Vip, 35)
.updateShowPrice(SeatType::Premium, 30)
.updateShowPrice(SeatType::Executive, 25)
.updateShowPrice(SeatType::Standard, 20)
.create();
cineplex->addShow(incp_cine_h1_morn);
cineplex->addShow(batman_cine_h2_night);
shared_ptr<Ticket> t1 = BookingManager(10001, cineplex,cineplex->getShowById(1001))
.reservedSeats("A", { 4,5,6 })
.addCustomerData("Linda McCarty", "+1-637-765-4567")
.PayAndBook(make_shared<CreditCardPayment>());
t1->printTicket();
incp_cine_h1_morn->displayShowDetails();
shared_ptr<Ticket> t2 = BookingManager(10002, cineplex, cineplex->getShowById(1002))
.reservedSeats("C", { 7,8,9 })
.addCustomerData("Dorothy Levy", "+1-435-765-1122")
.PayAndBook(make_shared<PayPalPayment>());
shared_ptr<Ticket> t3 = BookingManager(10003, cineplex, cineplex->getShowById(1002))
.reservedSeats("B", { 4,5 })
.addCustomerData("Raya Velasquez", "+1-321-234-3322")
.PayAndBook(make_shared<StripPayment>());
t2->printTicket();
t3->printTicket();
batman_cine_h2_night->displayShowDetails();
t2->cancelTicket();
batman_cine_h2_night->displayShowDetails();
return 0;
}