forked from abidh8820/Regional-Traffic-Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCityMap.h
182 lines (166 loc) · 4.04 KB
/
CityMap.h
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
#include<bits/stdc++.h>
#include "Vehicle.h"
using namespace std;
void RoadStatus(int noofCar);
class CityMap
{
private:
string HospitalAdress;
string PoliceStationAdress;
string RabStationAdress;
string StadiumAdress;
string SchoolAdress;
string ShoppingMall;
string CentralMosque;
int noofCar;
int carlimit;
public:
//vector<Vehicle>vivi;
CityMap()
{
HospitalAdress="House-50, Road-9, Sector-5, Uttara, Dhaka-1230";
PoliceStationAdress="House-23 , Road-15 , Sector-3, Uttara, Dhaka-1230";
RabStationAdress="House-20, Road-3, Sector-4, Uttara, Dhaka-1230";
StadiumAdress="House-10, Road- 9, Sector- 5, Uttara, Dhaka-1230";
ShoppingMall="House-5, Road- 25, Sector -3, Uttara, Dhaka-1230";
CentralMosque="House- 29, Road -10, Sector -5, Uttara, Dhaka-1230";
noofCar=0;
}
void AddVehicleInfo(/*Vehicle &vivia*/)
{
noofCar++;
//vivi.push_back(vivia);
///add vehicle objects
}
void TrafficCondition()
{
if(noofCar<20)
{
cout<<"Low Traffic"<<endl;
}
else if(noofCar>20 && noofCar<50)
{
cout<<"Medium Traffic"<<endl;
}
else
{
cout<<"Heavy Traffic than usual"<<endl;
}
}
friend void RoadStatus(int noofCar);
void PrintMap()
{
ifstream filepointer;
string line;
filepointer.open("map.txt");
getline(filepointer,line);
while ( !filepointer.eof() )
{
cout << line;
cout<<endl;
getline(filepointer,line);
}
filepointer.close();
}
string returnOption()
{
findpath:
int option;
cout<<"--Enter Option:\n1. Hospital Adress\n2.Police Station Adress\n3.Rab Station Adress\n4.Stadium Adress\n";
cout<<"5.Shopping Mall Adress\n6.Central Mosque Adress"<<endl;
cin>>option;
try
{
if(option==1)
{
return HospitalAdress;
}
else if(option==2)
{
return PoliceStationAdress;
}
else if(option==3)
{
return RabStationAdress;
}
else if(option==4)
{
return StadiumAdress;
}
else if(option==5)
{
return ShoppingMall;
}
else if(option==6)
{
return CentralMosque;
}
else
{
throw(option);
}
}
catch(int option)
{
cout<<option<<" is a Invalid Option! "<<endl;
goto findpath;
}
}
void printAdress()
{
string adress=returnOption();
cout<<"The following Adress:\n"<<adress<<endl;
}
};
void RoadStatus(int noofCar)
{
if(noofCar<20)
{
cout<<"Low Traffic"<<endl;
}
else if(noofCar>20 && noofCar<50)
{
cout<<"Medium Traffic"<<endl;
}
else
{
cout<<"Heavy Traffic than usual"<<endl;
}
}
class Route: public CityMap
{
private:
string destination;
string source;
public:
Route()
{
destination=" ";
source=" ";
}
void TakeSource()
{
cout<<"Enter your source adress: ";
source=returnOption();
}
void TakeDestination()
{
cout<<"Enter your destination :";
destination=returnOption();
}
void PrintRoute()
{
ifstream filepointer;
string line;
filepointer.open("Route.txt");
getline(filepointer,line);
while ( !filepointer.eof() )
{
cout << line;
cout<<endl;
getline(filepointer,line);
}
filepointer.close();
}
~Route() {}
};