Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My knowledge of linked lists and stacks is very limited and I have no clue how to do this program. I've tried it but I've
My knowledge of linked lists and stacks is very limited and I have no clue how to do this program. I've tried it but I've never programmed anything this complicated.
Plan a Flight Introduction: In this project, you will determine all possible flight plans for a person wishing to travel between two different cities serviced hy an airline (assuming a palh exisis). You will also calculale he tolal cosu incurred for all parts of the trip. For this project, you will use information from two different input files in order to calculate the trip plan and total cost. 1. Origination and Destination Data This file will contain a sequence of city pairs representing different legs of flights that can be considered in preparing a flight plan. For each leg, the file wil also contain a dollar cos for that leg and a time to travel". For each pair in the file, you can assume lha i is possible lo fly holh directions. 2. Requested Flights - This file will contain a sequence of origin'destination city pairs. For each pair, your program will determine if the flighl is or is no possible. If il is passible, it will oulpul Lo a file the flight plan with the total cost for he igh. If s nol possible, then a suitahle message will be written to the output file The names of the two input files as well as lhe oulput file will he provided via command line argumens Flight Data Consider a light from Dallas to Paris. It's possible that there is a direct flight, or it may be the case thal a stop mus be made in Chicago. One stop in Chicago would mean the flight would have two legs. We can think of the complete set of flights between different cities serviced by our airline as a directed graph. An example of a directed graph is given in Figure 1 In this example, an arrow from one city to anoher indicales the direction of travel. The opposile direction is not possible unless a similar arrow is present in the graph. For this programming challenge, each arrow or flight palh would also have a co associaled wilh il. If we wanted lo travel from El Paso Lo cily Chicago. we would have to pass through Detroit. This would be a trip with two legs. It is possible that there might not be a path from one city to another city. In this case, you'd print an crror messagc indicating such. In forming a flight plan from a set of flight legs, one must consider the possibility of cycles. In Figure 1 nolice there is a cycle involving Chicago, Fresno, and Greensboro. In a flight plan from city X Lo cily Y, a particular city should appear no more than one tme The input file for flight data will represent a sequence of origin destination city pairs with a cost of that lighl The first line of the input file will contain an integer which indicales the Lotal number of origin destination pairs contained in the file In the spirit of simplicity, we will not consider layovers in this projcct
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