Problem

Complete the following tasks:a. Create a calcDistance()function template that accepts two...

Complete the following tasks:

a. Create a calcDistance()function template that accepts two parameters representing two distances from a given point. The function returns the total distance as an integer.


b. Create a City class with fields for the city name and for the distance from Chicago, the hub city for Amalgamated Airlines. Overload the + operator to sum the distances to produce a City result in which the city name contains the two operand city names (for example, “New York to Los Angeles”) and the distance contains the total distance.


c. Create a Planet class with fields for the planet name and distance from Earth, the hub planet for the new Amalgamated Galactic Travel Corporation. Overload the + operator to sum the distances to produce a Planet result in which the planet name contains the two operand planet names (for example, “Venus to Mars”) and the distance contains the total distance.


d. Write a main()function that declares several integer, double, and City and Planet objects, and uses the calcDistance()function to compute the distance for several pairs. Save the file as Distance.cpp.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT