Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++, Java, or Python classes, attributes, and operations, develop an object-oriented program that would model the distance among cities. Your program must provide a

Using C++, Java, or Python classes, attributes, and operations, develop an object-oriented program that would model the distance among cities. Your program must provide a class to represent cities, i.e., City, and another one to model the concept of distance, Distance. To test your program, you will create a few objects from a file containing the following information. Paris, Berlin, 1000 km Paris, Vienna, 1200 km Berlin, Vienna, 681 km Please note that the class City shall not contain duplicates. Although the city Paris appears in two rows only one object belong to the class City will be created. You must provide a method called, getDistance that will return the distance between the source and target city if this information is available. It is up to you to decide the best place this method. If the distance between source and target cities is not available, e.g., Berlin, London, getDistance must return -1. However, the distance between Berlin and Paris must be returned even the data set only provided an entry from Paris to Berlin.

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

9. Acquire group actions history data.

Answered: 1 week ago