-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSurgeryTheatre.cpp
60 lines (50 loc) · 1.36 KB
/
SurgeryTheatre.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
//
// Created by quartie on 2018-05-13.
//
#include "SurgeryTheatre.h"
SurgeryTheatre::SurgeryTheatre()
{
numOfSurgeries = 0;
timeScheduled = 0;
opening = 0;
closing = 0;
surgeries = new Surgery[19];
}
SurgeryTheatre::~SurgeryTheatre()
{
delete[] surgeries;
}
void SurgeryTheatre::setHours(const int opening, const int closing)
{
this->opening = opening;
this->closing = closing;
}
int SurgeryTheatre::getTheatreCapacity() const
{
return (closing - opening);
}
bool SurgeryTheatre::timeLeft(Surgery surgery) const
{
return ((closing - opening) - timeScheduled >= surgery.getDuration());
}
void SurgeryTheatre::planSurgery(const Surgery surgery)
{
surgeries[numOfSurgeries] = surgery;
timeScheduled += surgery.getDuration();
numOfSurgeries ++;
}
void SurgeryTheatre::showTheatreSchedule()
{
std::cout << "Total time Initially: " << closing - opening << " minutes" << std::endl;
std::cout << "Total time scheduled: " << timeScheduled << " minutes" << std::endl;
std::cout << "Total time available: " << (closing - opening) - timeScheduled << " minutes" << std::endl;
std::cout << "Number of surgeries : " << numOfSurgeries << std::endl;
for (int i = 0; i < numOfSurgeries; i++)
{
std::cout << surgeries[i] << std::endl;
}
}
int SurgeryTheatre::getTimeScheduled() const
{
return timeScheduled;
}