Question
C++ Flight Program You must use a graph to write the program -------------------------------------------------------------------------------------------------------- For the Graphs, Verticies Weights and Edges are stored in below load.txt
C++ Flight Program
You must use a graph to write the program
--------------------------------------------------------------------------------------------------------
For the Graphs, Verticies Weights and Edges are stored in below load.txt file
These vertices, edges and weights are stored in the text file named load.txt file at the bottom. When the program starts, it will use the load.txt file to load the vertices, edges and weights into your program.
--------------------------------------------------------------------------------------------------------
Flight Types (Files at bottom)
Connected Flights:
A direct connection means you can fly from the departure city to the destination city without having to first fly through another city. For this type of connection, you list the departure city, the destination city, and the distance between the two cities.
Through Flights (Listed Below):
A through connection means you can fly from the departure city to the destination city, but you first have to fly to at least one other city. For this type of connection, you list the departure city, the destination city, each city between the departure city and the destination city which is part of the connection, and the total distance between the departure city and the destination city.
--------------------------------------------------------------------------------------------------------
Program Startup
As mentioned above, when the program starts, it will use the load.txt file to load the vertices, edges and weights into the graph. The program then will display a menu, and prompt the user to enter a choice:
1. Choose departure city 2. Exit
You may assume the user enters 1 or 2. No input validation is required.
If the user chooses 2. Exit, then the program ends.
Program lists Departure Cities, and user chooses
If the user choose 1. Choose departure city, then the program lists the cities. The cities don't have to be listed in any particular order. However, an ascending letter or number should be to the left of each city so the user can use that letter or number to choose a city. For example:
1. Los Angeles 2. Beijing 3. San Diego (and so on) Choose city:
or
A. Los Angeles B. Beijing C. San Diego (and so on) Choose city:
You may assume the user enters a valid number or letter; no input validation is required.
--------------------------------------------------------------------------------------------------------
Program lists Destination Cities, and user chooses
Once a user chooses a city, then the program displays "Destination cites" followed by all of the cities except the departure city. Again, the cities don't have to be listed in any particular order, but an ascending letter or number should be to the left of each city so the user can use that letter or number to choose a city.
You again may assume the user enters a valid number or letter; no input validation is required.
--------------------------------------------------------------------------------------------------------
If no connection
Once the user chooses a destination city, if there is no direct or through connection between the departure and destination cities, then the program will output:
No connection between [name of departure city] and [name of destination city] Press any key to return to menu.
After the user presses the any key (we'll assume the user has an any key on their keyboard :-), then the menu which displayed at the program startup (1. Choose departure city 2. Exit) will re-display and the program will continue as stated above.
--------------------------------------------------------------------------------------------------------
If connection, direct connection?
If there is some connection between the departure and destination cities (See load.txt and connected cities notes below) ... the next issue is whether there is a direct connection between the departure and destination cities.
If there is no direct connection between the departure and destination cities (in other words, only a through connection), then the program will output:
No direction connection between [name of departure city] and [name of destination city]
Then the program will output the information in the next section (If connection is a through connection?).
If there is a direct connection between the departure and destination cities (there presumably only would be one), then the program will output:
Direct connection between [name of departure city] and [name of destination city]
Then the program will output the information in the next section (If connection, through connection?).
--------------------------------------------------------------------------------------------------------
If connection, through connection?
If there is no through connection between the departure and destination cities (in other words, only a direct connection), then the program will output:
No through connection between [name of departure city] and [name of destination city] Press any key to return to menu [after which the menu displayed at program startup is re-displayed]
If there is at least one through connection between the departure and destination cities, then the program will output all through connections (there may be more than one) in ascending order of distance, listing the intermediate cities, as follows:
Through connection between [name of departure city] and [name of destination city] via [list name or names of cities in between] - [number of miles] miles
After this listing, the program prompts the user to "Press any key to return to menu", after which the menu displayed at program startup is re-displayed.
NEEDED FILES:
//load.txt file
//Direct Connections Los Angeles, Anchorage, 2340 Anchorage, Beijing,3970 Beijing, Los Angeles, 6260 Los Angeles, Maui, 2490 Maui, San Diego, 2540 San Diego, Las Vegas, 265 Los Angeles, San Diego, 200
//Connecting Cities Notes
//Through Connections Maui , Los Angeles, Beijing Maui, Los Angeles, Anchorage Maui, San Diego, Las Vegas Las Vegas, San Diego, Las Angeles, Beijing
Step 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