-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lights.cpp
44 lines (38 loc) · 836 Bytes
/
Lights.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
//jeff henebury
//implementation of the Lights class and methods
//
#include "Lights.h"
Lights::Lights()
{
currentRoom = "Living Room";
deviceSound = "CLICK! (There go the lights!)\n";
}
Lights::~Lights()
{
}
std::string Lights::getCurrentRoom()
{
return currentRoom;
}
void Lights::setCurrentRoom(std::string newRoom)
{
if (std::find(rooms.begin(), rooms.end(), newRoom) != rooms.end()) //check the rooms vector for the input
{
currentRoom = newRoom;
}
else {
std::cout << "I'm sorry, but " << newRoom << " is not in my list of rooms! Please try again.\n";
};
}
void Lights::printRooms()
{
if (power) {
cout << "Lights are currently ON in the following rooms:\n";
}
else if (!power) {
cout << "Lights are currently OFF in the following rooms:\n";
}
for (string room : rooms) {
cout << room << "\n";
}
}