Implement a graph data structure in java, computer science homework help

Implement a graph data structure in java, computer science homework help

Task Description:

Input: Two files – one contains city data and the other contains road data.

• city.dat: This file contains information about cities, where each line has 5 attributes: City Number, City_Code (2 letters), Full_City_Name, Population, and Elevation.

• road.dat: This file contains information about roads, where each line has 3 attributes: From_City, To_City, and Distance. Note that all roads are assumed to be one-way.

Output: A menu driven system which has the following options.

• Read the original data files and store the data to appropriate data structures.

• Let the user of this program enter a City Code and your program should print out the city information (the whole record).

• Find the connection between two cities.

• The user will be asked to enter two City Codes. The program finds the shortest distance between the two cities.

• Insert a road (edge) between two cities

• The user will be asked to enter two City Codes and its Distance. Note that if a pair of City Codes already exists or if the City Code doesn’t exist, print out a warning message.

• Delete a road (edge)

• The user will be asked to enter two City Codes for a road. Note that if the road entered doesn’t exist, print out a warning message.

• Exit.

Your program should resemble the following output (the user inputs are underlined):

% java Project3 Command? H

Q Query the city information by entering the city code.

D Find the minimum distance between two cities.

I Insert a road by entering two city codes and distance.

R Remove an existing road by entering two city codes.

H Display this message.

E Exit.

Command? Q

City code: LV

12 LV LEE VINING 8390 5983

Command? D

City codes: CH PM

The minimum distance between CHINO HILLS and POMONA is 143 through the route: CH, xxx, …, xxx, PM.

Command? I

City codes and distance: GG BO 100

You have inserted a road from GARDEN GRPVE to BOSSTOWN with a distance of 100.

Command? R

City codes: KV MP

The road from KERNVILLE and MOUNTAIN PASS doesn’t exist.

Command? E

Programming Guides:

Create a Java Digraph (directed graph) class to store the city and road information. Use Dijkstra’s algorithm for finding the shortest distances between cities.

What to Submit?

1. Java source code (Project3.java, which contains the main method and other supported java files).

2. Please zip all documents

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper