Trains Task For this assignment, you are to find a solution to a graph problem by utilizing various structures that we have discussed and used this past semester such as...

Trains
Task
For this assignment, you are to find a solution to a graph problem by utilizing various structures that we have discussed and used this past semester such as bst/linked-lists/graphing/priority queue. Your solution should be in C++ and should compile on the class virtual machine. The details for the assignment can be found below.


For this project you will be in charge of helping travelers schedule their trips on trains which are leaving and arriving at various stations. You are to create a program that will let a user find a path between two stations among other features. You will be provided with two files:


trains.dat which will have the schedule of trains running between stations
stations.dat which contains the list of stations that are in your train network.
Your program will provide the following functionality:


Print complete train schedule for all stations
Print complete train schedule for a specific station
For a station name, look up station number
For a station number, look up the satation name
Determine if there is a direct rout from station A to station B
Determine if station B can be reached from station A
For any two stations determine the shortests amount of time it will take to go from A to B wihtout layovers(time should be printed in HH:MM format) If no route exists, alert the user
For any two stations determine the shortests overall travel time including layovers at stations (time should be printed in HH:MM format) If no route exists, alert the user
For any two stations determine the shortest overall travel time including layovers at stations when requesting to leave at a certain time (format: HH:MM). In other words a passenger is able to say they want to leave at 09:30 and your program will take this into account when choosing paths
Whenever a user is asked for a departure and arrival station they should enter the station numbers. The exception to this is the look up station id by name function


Input Files
Your program will read in 2 input files


stations.dat
trains.dat
stations.dat
stations.dat contains the mapping of station names to their unique id numbers. The file format will consist of a series of ID and name pairs. An example would look similiar to


1 dixon
2 campbell
3 spring
4 fulton
You can assume the following about stations.dat


The station id's will fall in the range of 1 to 199
The id's may not be sequencially in order
Each station name will be at most 25 characters in length and no spaces will be included
The file will not specify how many stations are in the file
trains.dat
This file contains information regarding the trains that will be traveling between the various stations. The information contained in this file includes the departure and arrival station id's as well as the departure and arrival times in 24 hour time. A sample file would look similiar to


1 2 0830 1120
1 4 1100 1540
3 2 1200 1600
4 3 1600 1800
2 1 0900 1000
You can assume the following about the trains.dat file


The arrival and departure times will always be 4 digits in length
No trains will cross the midnight mark. In other words no train would leave the stations at 2300 and arrive at 0130 the next morning
The arrival and departure times will be in 24 hour time with no colon seperating the hours from minutes
Expectations
This assignment is much more free form then the ones i have given you previously. There is no expected output file to match or provided header file implementations to meet. You should take this as an opportunity to show what you have learned over the past semester to implement a more ambitious program(even an extremely arbitrary one). Choose your structures wisely and this is actually fairly strait forward. The STL library or other built in libraries for stacks/queues/vectors are open for use with the exception of any prebuilt graphing structures or algorithms


Example Output
========================================================================
READING RAILWAYS SCHEDULER
========================================================================
Options - (Enter the number of your selected option)
(1) - Print full schedule
(2) - Print station schedule
(3) - Look up stationd id
(4) - Look up station name
(5) - Servie available
(6) - Nonstop service available
(7) - Find route (Shortest riding time)
(8) - Find route (Shortest overall travel time)
(9) - Exit
Enter option: 2
Enter station id: 1
Schedule for xxxxx
Departure to xxxxxx at 0830, arriving at 1120
Departure to xxxxx at 1100, arriving at 1540
Arrival from xxxxxx at 2200
Enter option: 4
Enter station name: xxxxx
xxxxxxxx station id is 1
Enter option: 5
Enter departure station id: 1
Enter destination station id: 2
Service is available from xxxxxxx to xxxxxx
Enter option: 7
Enter departure station id: 2
Enter destination station id: 3
Time on train to go from xxxxxxx to xxxxxx is 7 hours and 40 minutes
Itinerary
---------
Leave from xxxxxx at 0900, arrive at xxxxxx at 1000
Leave from xxxxxx at 1100, arrive at xxxxxx at 1540
Leave from xxxxxx at 1600, arrive at xxxxxx at 1800
Enter option: 9
Goodbye!
May 03, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here