Question: Write a Map class that is composed of a Location class. Location class has three private variable string nameOfCity, double variables, latitude and longitude. It

Write a Map class that is composed of a Location class.

Location class has three private variable string nameOfCity, double variables, latitude and longitude.

It has a constructor to initialize these and also the usual getters.

It has three functions: string toString() which prints

:double getFlyingTime(Location l) which returns the flying time between this

and location l. It uses the formula that time = distance/speed. speed = 673 miles/hour. No need to convert to minutes.

: double getDistance(Location l). This method is used by getFlyingTime.

The Map class has function double getFlyingTime(string l, string r); It returns -1 if the two cities are not found in its database.

Map class has a vector of 4 location objects.

The driver program creates the map by providing the locations to the Map.

Once the Map is created, it asks the user for two cities. If the cities are found, it returns the flying distance otherwise it says cities not found. The cities have first letter capitalized and rest small

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!