-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVacuum.cpp
43 lines (38 loc) · 903 Bytes
/
Vacuum.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
//jeff henebury
//implementation of the vacuum class and methods
//
#include "Vacuum.h"
Vacuum::Vacuum()
{
currentRoom = "Living Room";
deviceSound = "VROOOOOOOM! (Sorry kitten, I know you're scared of the vacuum!)\n";
}
Vacuum::~Vacuum()
{
}
std::string Vacuum::getCurrentRoom()
{
return currentRoom;
}
void Vacuum::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 Vacuum::printRooms()
{
if (power) {
cout << "Vacuum is currently ON and cleaning the following rooms:\n";
}
else if (!power) {
cout << "Vacuum is currently OFF. It is connected for cleaning the following rooms:\n";
}
for (string room : rooms) {
cout << room << "\n";
}
}