forked from matkatmusic/PFMCPP_Project5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlRoom.cpp
More file actions
99 lines (82 loc) · 2.41 KB
/
Copy pathControlRoom.cpp
File metadata and controls
99 lines (82 loc) · 2.41 KB
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
#include <iostream>
#include "ControlRoom.h"
ControlRoom::ControlRoom()
: length(15), width(9), height(2), numberSeats(3), studioPowerState(false), name("Control Room A"), monitorBrand("ATC")
{
std::cout << "ControlRoom being constructed." << std::endl;
}
ControlRoom::~ControlRoom()
{
std::cout << "ControlRoom being deconstructed." << std::endl;
}
ControlRoom::Computer::Computer() : powerState(true)
{
std::cout << "Computer being constructed." << std::endl;
}
ControlRoom::Computer::~Computer()
{
std::cout << "Computer being deconstructed." << std::endl;
}
void ControlRoom::aboutControlRoom() const
{
std::cout << "This control room has " << this->numberSeats << " seats." << std::endl;
}
int ControlRoom::hoursInBudget(int engineerRate, int studioRate, int budget) const
{
int hours = 0;
int cost = 0;
while (cost <= budget)
{
++hours;
cost = (hours * engineerRate) + (hours * studioRate);
}
std::cout << "You have " << hours << " hours in your budget." << std::endl;
return hours;
}
void ControlRoom::seatEngineer(std::string engineerName) const
{
std::cout << "Today we're enjoying the mixing skills of " << engineerName << std::endl;
}
bool ControlRoom::switchStudioPower()
{
studioPowerState = !studioPowerState;
std::cout << "Studio power is " << (studioPowerState ? "on" : "off") << std::endl;
return studioPowerState;
}
int ControlRoom::Computer::hoursTillComputerCrash(bool runningProTools)
{
int hours = 0;
float heat = 1.1f;
float numberOfPlugins = 1.f;
float willCrash = 0.3f;
while(willCrash < 1.0f )
{
willCrash = willCrash * heat * numberOfPlugins;
numberOfPlugins = numberOfPlugins * 1.2f;
if (runningProTools == true)
{
heat = heat * 1.15f;
}
else
{
heat = heat * 1.07f;
}
++hours;
}
std::cout << "Computer will crash in " << hours << " hours." << std::endl;
return hours;
}
void ControlRoom::Computer::aboutComputer() const
{
std::cout << "This computer is made by " << this->brand << std::endl;
}
bool ControlRoom::Computer::switchOnOff()
{
powerState = !powerState;
std::cout << "Computer is " << (powerState ? "on" : "off") << std::endl;
return powerState;
}
std::string ControlRoom::Computer::runSoftware(std::string programName) const
{
return programName;
}