Answered step by step
Verified Expert Solution
Question
1 Approved Answer
city.dat contains City_Number, City_Code (2 letters), Full_City_Name, Population, and Elevation link for downloading city.dat file https://ufile.io/yjfoe road.dat contains From_City_Number, To_City_Number, and Distance link for downloading
city.dat contains City_Number, City_Code (2 letters), Full_City_Name, Population, and Elevation
link for downloading city.dat file https://ufile.io/yjfoe
road.dat contains From_City_Number, To_City_Number, and Distance
link for downloading road.dat file https://ufile.io/5nbhz
**JAVA PROGRAM** Use Dijkstra's Algorithm to develop a directed graph structure with min-heap 1. The software builds a directed graph by reading the information from two resource files 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. a. b. 2. User menu a. Q: Query the city information by entering the city code i. The software will ask for city code in a new line. User will then enter the city code. b. D: Find the shortest distance between two cities i. The software will ask for city codes in a new line. User will then enter two city codes in one line, separated by one space c. I Insert a road by entering two city codes and distance. The software will ask for two City Codes and the Distance. User will enter them in one line, separated by a space d. R: Remove an existing road by entering two city codes. i. The software will ask for two City Codes. User will enter them in one line, separated by a space e. H: Display this message. i. The software displays the set of command to help user f. E: Exit. 3. Create a Digraph (directed graph) class to store the city and road information 4. Test with first 5 cities 5. Program must catch invalid inputs a. Wrong command (i.e. wrong numbers, multiple letters, upper case/lower case letters) Provide appropriate response for errors from user input 6. a. b. c. d. e. f. g. h. i. j. City doesn't exist in resource file Road doesn't exist between two cities (it is a directed graph) One of the two cities does not exist Inserting a road that already existed Inserting a road between two non-existing cities Inserting a road between one existing and one non-existing city Removing a non-exiting city Removing a city that has been previously removed by user Removing a road between two non-existing cities Removing a road between one existing and one non-exiting cityStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started