-
Notifications
You must be signed in to change notification settings - Fork 1
/
stadium.cpp
204 lines (176 loc) · 4.01 KB
/
stadium.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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include "stadium.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <fstream>
#include <ios>
#include <limits>
#include <list>
#include <queue>
#include <ctime>
#include <time.h>
#include <stdlib.h>
#include <random>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>
#include <iterator>
#include <sstream>
// CONSTRUCTOR - Default
stadium::stadium()
{
surface = false;
day = 1;
month = 1;
year = 1920;
}
// CONSTRUCTOR - User input
stadium::stadium(string inStadium, //IN - Stadium Name
string inLeague, //IN - League
string inTeam, //IN - Team Name
bool inSurface, //IN - Surface Type
int inDay,
int inMonth,
int inYear)
{
surface = inSurface;
stadiumName = inStadium;
teamName = inTeam;
league = inLeague;
day = inDay;
year = inYear;
month = inMonth;
}
// METHOD - setStadium: sets the current stadium name
void stadium::setStadium(string inStadium) //IN - Stadium Name
{
stadiumName = inStadium;
}
// METHOD - getStadium: gets the current stadium name
string stadium::getStadium() const
{
return stadiumName;
}
// METHOD - setLeague: sets the current league
void stadium::setLeague(string inLeague) //IN - League
{
league = inLeague;
}
// METHOD - getLeague: gets the current league
string stadium::getLeague() const
{
return league;
}
// METHOD - setTeam: Sets the current team name
void stadium::setTeam(string inTeam) //IN - Team Name
{
teamName = inTeam;
}
// METHOD - getTeam: gets the current team name
string stadium::getTeam() const
{
return teamName;
}
// METHOD - setSurface: sets the current stadium surface
//- True for Grass, False for Non Grass
void stadium::setSurface(bool inSurface)
{
surface = inSurface;
}
// METHOD - getSurface: gets the current surface
bool stadium::getSurface() const
{
return surface;
}
// METHOD - setYear: sets the Year opened
void stadium::setYear(int inYear) //IN - Year
{
year = inYear;
}
// METHOD - getYear: gets & returns the year opened
int stadium::getYear() const
{
return year;
}
// METHOD - setMonth: sets the Month opened
void stadium::setMonth(int inMonth) //IN - Month
{
month = inMonth;
}
// METHOD - getMonth: gets & returns the day opened
int stadium::getMonth() const
{
return month;
}
// METHOD - setDay: sets the Day opened
void stadium::setDay(int inDay) //IN - Day
{
day = inDay;
}
// METHOD - getDay: gets & returns the day opened
int stadium::getDay() const
{
return day;
}
// METHOD - setCity: sets the City of Stadium
void stadium::setCity(string inCity) //IN - City
{
city = inCity;
}
// METHOD - getCity: gets & returns the city of stadium
string stadium::getCity() const
{
return city;
}
// METHOD - setDay: sets the State of Stadium
void stadium::setState(string inState) //IN - State
{
state = inState;
}
// METHOD - getDay: gets & returns the State of stadium
string stadium::getState() const
{
return state;
}
// METHOD - setConnect: Sets the current connections of the stadium
void stadium::setConnect(string &inConnections)
{
// Segments after split
string token;
// CALC - Reading in the string to be split
std::istringstream ss(inConnections);
// WHILE LOOP - Splitting the string
while(std::getline(ss, token, ','))
{
connections.push_back(token);
} // END OF SPLIT STRING WHILE LOOP
}
// METHOD - getConnect: Gets the current connections of the stadium
vector<string> stadium::getConnect()
{
return connections;
}
// METHOD - setConnect: Sets the current connection distances of the stadium
void stadium::setConnectD(string &inConnectionD)
{
// Segments after split
string token;
int result;
// CALC - Reading in the string to be split
std::istringstream ss(inConnectionD);
// WHILE LOOP - Splitting the string
while(std::getline(ss, token, ','))
{
stringstream convert(token);
convert >> result;
// Typecasting the string to an integer
connectionD.push_back(result);
} // END OF SPLIT STRING WHILE LOOP
}
// METHOD - getConnect: Gets the current connection distances of the stadium
vector<int> stadium::getConnectD()
{
return connectionD;
}