forked from CodeWithKartik/BookMyShow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Slot.cpp
41 lines (40 loc) · 1020 Bytes
/
Slot.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
#include "Slot.h"
Slot::Slot(int st[], int et[], ULI id, double ct) {
for (register int i = 0; i < 6; i++) {
str_time[i] = st[i];
end_time[i] = et[i];
}
movieID = id;
cost = ct;
}
Slot::Slot(const Slot &cpy) {
const int *st = cpy.GetStrTime();
const int *et = cpy.GetEndTime();
for (register int i = 0; i < 6; i++) {
str_time[i] = st[i];
end_time[i] = et[i];
}
movieID = cpy.GetMovieID();
cost = cpy.GetCost();
}
//Slot::~Slot() {
//}
std::ostream& operator<<(std::ostream& os, const Slot st) {
os<<"Movie Showing: "<<st.GetMovieID()<<"\n";
os<<"Start Time: ";
for (register int i = 0; i < 6; i++) {
os<<st.GetStrTime()[i];
if (i == 1 || i == 3)
os<<":";
}
os<<"\n";
os<<"End Time: ";
for (register int i = 0; i < 6; i++) {
os<<st.GetEndTime()[i];
if (i == 1 || i == 3)
os<<":";
}
os<<"\n";
os<<"Movie Charges: "<<st.GetCost()<<"\n";
return os;
}