Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions