CMSC 204 Computer Science II


In this project you will be creating an application to maintain a network of towns and the roads connecting them. The application will use Dijkstra’s Shortest Path algorithm to find the shortest distance between any two towns.

Implement Graph Interface

Use Graph to maintain a network of Vertices

Implement Shortest Path Algorithm

Data Element – Town (Vertex)
Create a Town class that holds the name of the town and a list of adjacent towns, and other fields as desired, and the traditional methods (constructors, getters/setters, toString, etc.).  It will implement the Comparable interface.  This is the class header:

public class Town implements Comparable<Town>

Two towns will be considered the same if their name is the same.

Data Element – Road (Edge)

Create a class Road that can represent the edges of a Graph of Towns.  The class must implement Comparable.  The class stores references to the two vertices(Town endpoints), the distance between vertices, and a name, and the traditional methods (constructors, getters/setters, toString, etc.), and a compareTo, which compares two Road objects. Since this is a undirected graph, an edge from A to B is equal to an edge from B to A. This is the class header:

 public class Road implements Comparable<Road>

Data Structure – TownGraph, implements GraphInterface

Create a TownGraph class that implements the GraphInterface given you.  For Graph<V,E>,  V is the vertex type (a Town), E is the edge type (a Road).  You will need to decide how to store the graph, use an adjacent matrix or an adjacency list.  This is the class header:

public class TownGraph implements GraphInterface<Town, Road>
Within the Graph interface is a method shortestPath, which finds the shortest path from a given source Town to a destination Town. Since there is a unique shortest path from every vertex to the source, there is a back-pointer to the previous vertex.  The method shortestPath calls dijkstraShortestPath which finds the shortest path from the source to every other vertex in the graph.  You will be coding the Dijkstra’s Shortest Path algorithm.  You will then be able to find the connections between two towns through the roads that connect them.

You may use the adjacency matrix approach found in the text book, or you may use a set of Towns and a set of Roads. The ShortestPath algorithm typically uses a weighted graph which means that the edges have a weight, and this is used to determine the shortest path.  For this implementation, each weight will be the distance of the road in miles.
Data Manager – implements TownGraphManagerInterface

Your TownGraphManager will hold an object of your Graph. Implement the TownGraphManagerInterface. There are methods to populate the graph (reading from a text file), add a town (vertices), add a road (edge), list all towns and all roads, and list towns adjacent to a given town.   
Your solution will find the shortest path from a start town to a destination town.  It will account for the possibility of a disjoint graph (i.e., not all vertices can be reached from all other vertices.)

You may add any methods as needed for your design.

Exception Classes

IOException – created and thrown when user selects an input file that cannot be read (check out the methods of File).

GUI Driver (provided for you)
The GUI will have three sections: a Town section, a Road section, and a Find Connection section.

1.Create a JUnit Test – TownGraphManagerTest_STUDENT. Test all the methods of the TownGraphManager with a different set of data than the TownGraphManagerTest provided for you.
2.Create a JUnit Test – TownGraphTest_STUDENT. Test all the methods of the TownGraph with a different set of data than the TownGraphTest provided for you.
3.Create a Junit Test – RoadTest_STUDENT. Test all the methods of your Road class.
4.Create a Junit test – TownTest_STUDENT. Test all the methods of your Town class.

Populating the Data Structure

You will be reading from a data file.  You are provided with two sample files: MD Towns.txt and US Towns.txt along with two PowerPoint slides showing these graphs.

Calculate your paper price
Pages (550 words)
Approximate price: -

Quality Research Papers

We always make sure that our academic writers follow all your instructions precisely. You can choose your academic level and we will assign a writer who has a respective degree.


Best Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.


Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document.


On time Delivery

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. Otherwise a 100% refund is guaranteed.


Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. We also promise maximum confidentiality in all of our services.


24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Homework Market

Place your order

Fill in the order form and provide all details of your assignment.

Homework Market

Proceed with the payment

Choose the payment system that suits you most.

Homework Market

Receive the final file

Once your paper is ready, we will email it to you.

Academic Writing Services

Whether you have an urgent deadline or those that have time. You can take some time and relax after trusting us with your paper. We make sure that we conduct the academic writing services diligently.

Acemyhomework Acemyhomework


Essay Writing Service

Among the wide variety of academic work, essay writing is one of the simplest a student can ever come across. Usually, it is a task which students encounter and learn how to write whilst in high school. However, the case is quite different when it comes to university and college.

Acemyhomework Acemyhomework

Term Papers

Term Paper Writing

Are you looking for an online writing firm that can offer you reliable custom term paper writing help? Is your wish and desire to get someone who can guide you throughout the process of writing term papers? If yes, then you have come to the right place.

Acemyhomework Acemyhomework


Coursework Writing Help

Coursework is essential for every student in order to graduate from college. However, most of it is deadline-centric, and that becomes a challenge to most learners. With the amount of work, learners are receiving every day, finding time to work on every task is not easy.

Acemyhomework Acemyhomework


Online Homework Help

Online homework help services are an answer to every challenge that students go through. Despite the difference in the needs and levels of learning, all students can benefit from these services. Acemyhomework is one of the best online homework help service companies you can find on the internet.