# This is a lab that evaluates traffic in a city. Your job is to take...

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include "city_map.h"
#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <list>
#include <math.h>
#include <vector>

using namespace std;

// return square of a number
double sqr(double x)
{
return x * x;
}
//constructor
City_Map::City_Map()
{
string str;
int maxAvenue = 0; //max number of avenues
int maxStreet = 0; // max number of streets

while (getline(cin, str)) // read a line from standard input
{
stringstream s;
s << str;
// parse the string into intersection
Intersection *is = new Intersection;
s >> is->street;
s >> is->avenue;
s >> is->x;
s >> is->y;
s >> is->green[0];
s >> is->green[1];
all.push_back(is); // add intersection to the list
if ((is->avenue == 0) && (is->street == 0)) // check if it is the start point
{
first = is;
}
if ((is->avenue > maxAvenue) || ((is->avenue == maxAvenue) && (is->street > maxStreet))) // check if it is the last point
{
maxAvenue = is->avenue;
maxStreet = is->street;
last = is;
}
}
vector<vector<Intersection*>> iv; // create a matrix of intersections, to easily reach the neighbour nodes
iv.resize(maxStreet + 1);
for (int i = 0; i <= maxStreet; i++)
{...

By purchasing this solution you'll be able to access the following files:
Solution.cpp.

\$18.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Data Structures and Algorithms Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

• 1
• 2
• 3
Live Chats