-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoffice.cpp
More file actions
140 lines (110 loc) · 2.63 KB
/
office.cpp
File metadata and controls
140 lines (110 loc) · 2.63 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "office.h"
Office::Office()
{
}
Office::~Office()
{
}
/*
* Pre: None
*
* Post: integer value of total agents returned to caller.
*
* Purpose: To obtain the current amount of agents in the office.
*/
int Office::getTotalAgents()
{
return (agents.size());
}
/*
* Pre: None
*
* Post: integer value of total apartments returned to caller.
*
* Purpose: To obtain the current amount of apartments in the office.
*/
int Office::getTotalApartments()
{
return (apartments.size());
}
/*
* Pre: None
*
* Post: integer value of total tenants returned to caller.
*
* Purpose: To obtain the current amount of tenants in the office.
*/
int Office::getTotalTenants()
{
int tenant = 0;
// add the amount of tenants in each apartment to the counter.
for (size_t i = 0; i < apartments.size(); i++)
tenant += apartments[i].getTotalTenants();
return tenant;
}
/*
* Pre: None
*
* Post: Returns false if we cannot add more apartments to this office.
* Returns true if we can add the apartment, then adds the apartment.
*
* Purpose: To attempt to add an apartment to the vector
*/
bool Office::addApartment()
{
// validate if we can add more apartments to this office.
if (getTotalApartments() + 1 >= MAX_APARTMENTS)
return false;
else
{
// obtain information for the apartment.
// id must be generated
// add the apartment to the array, return true for valid entry
string address = promptAddress();
//apartments.push_back();
return true;
}
}
/*
* Pre: None
*
* Post: Files are loaded into the office
*
* Purpose: To load all the files and fill data within the office.
*/
void Office::loadOffice()
{
}
/*
* Pre: None
*
* Post: returns string containing the house location
*
* Purpose: To obtain information on the address of the user.
*/
string Office::promptAddress()
{
string address = " ";
cout << "Enter house number: ";
string houseNumber = io.getNumericResponse();
cout << endl;
cout << "Enter type of address (aka street, lane, drive): ";
string addressType = io.getAlphaResponse();
cout << endl;
cout << "Enter " << addressType << " name: ";
string streetName = io.getAlphaResponse() + " " + addressType;
cout << endl;
// TODO allow for spaces.
cout << "Enter city: ";
string city = io.getAlphaResponse();
cout << endl;
cout << "Enter State Abreviation: ";
string state = io.getAlphaResponse();
cout << endl;
cout << "Enter zip code: ";
string zip = io.getNumericResponse();
cout << endl;
address = houseNumber + " " + streetName + ", " +
city + ", " + state + " " + zip;
return address;
}