Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(In Java) Write a program that allows the user to read graph information from a text file that s/he specifies. Once the file is loaded,

(In Java) Write a program that allows the user to read graph information from a text file that s/he specifies. Once the file is loaded, the user should be able to view all the vertices and edges (including weights) of the graph. Use the following classes for the project design:

Vertex class: This should include an instance variable for the vertexs name, as well as instance variables for the various quantities needed in Dijkstras algorithm (distance, visited status, and previous vertex).

Edge class: This should include instance variables for the start and end vertices, as well as the edges weight. Graph class: This should include a list of Vertex objects and a list of Edge objects as instance variables. You can use java.util.ArrayList or java.util.LinkedList for these lists. This class should also include the following methods: o A method that loads information from a data file o A method that runs Dijkstras algorithm using a specified start and end vertex o A toString method that includes information about the graphs vertices and edges MappingApp class: This is the client program where all user input will be made. It should contain an instance of Graph and allow the user to load a data file, view the currently loaded graph, or find the shortest path between two vertices in the currently loaded graph. As mentioned before, display both the optimal cost as well as the path itself.

Implement error checking on all user inputs! This includes exception handling: possible crashes due to exceptions like InputMismatchException or FileNotFoundException should be gracefully handled. Your program should never crash due to user input.

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

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

Students also viewed these Databases questions

Question

4. Develop a self-directed learning module.

Answered: 1 week ago

Question

2. Provide recommendations for effective on-the-job training.

Answered: 1 week ago