本次作业案例分享是来自美国的一个关于数据结构相关的assignment代写

Flight Planner

Introduction

I’m sure we are all familiar with trips that take a couple (or more) shorter flights with layovers in between to get to our final destination. Sometimes this is done because of total price, total time, or the fact that there is no direct flight from where we are to our destination. In this project, you will use information on flights including the duration, cost, and carrier to determine all possible flight plans for a person wishing to travel between two different cities serviced by an airline (assuming a path exists). For each of these possible itineraries, you will also calculate the total cost and time incurred.

So we are all on the same page, let me define some terms with the hopes that I will stay consistent through the remainder of the write up.

● Originating City – Where the flight will be starting from
● Destination City – Where we are trying to get to
● Itinerary – A set of flights that start at originating city and end in destination city
● Leg – one flight that is part of an itinerary.

There will be two input files.

Origination and Destination Data – This file will contain a sequence of city pairs representing 0-stop flights that can be used in preparing a flight plan. For each of these, the file will also contain a dollar cost for that leg and a time to travel. For each pair in the file, you can assume that it is possible to fly both directions.

Requested Flights – This file will contain a sequence of origin/destination city pairs. For each pair, your program will determine if the flight is or is not possible. If it is possible, it will output to a file the flight plan with the total cost for the flight. If it is not possible, then a suitable message will be written to the output file.

The names of the two input files as well as the output file will be provided via command line arguments.

Flight Data

Consider a requested flight originating in Detroit with the destination of Fresno. From Figure 1, we can see that there is a direct flight, a flight that goes through Chicago (with 2 legs), and even longer paths like Detroit -> Austin -> Billings -> El Paso -> Greensboro -> Fresno (5 legs).

We can think of the complete set of flights between different cities serviced by our airlines as an undirected graph. In Figure 1, a line from one city to another indicates at least one bi-directional flight path between the cities. In other words, if Cities A and B are connected,that means there’s a flight from A -> B and a flight from B -> A. Of course, more than one airline could service flights between those cities. The price and flight time is the same for both directions for a particular airline. If we wanted to travel from El Paso to Chicago, we would have to pass through Detroit. This would be a trip with two legs and one included layover. Of course, it is possible that there is no way to get to a particular destination city from a particular originating city.

In forming a flight plan from a set of flight legs, one must consider the possibility of cycles. In Figure 1, notice that there is a cycle involving Chicago, Fresno, and Greensboro. In a flight plan from city X to city Y, a particular city should appear no more than one time. No one wants to fly in a circle like that…

介绍

我相信我们都熟悉需要几次(或更多)较短的航班并在中间停留才能到达最终目的地的旅行。 有时这样做是因为总价格、总时间或没有从我们所在位置到目的地的直飞航班。 在此项目中,您将使用航班信息(包括持续时间、费用和航空公司)来确定希望在由航空公司提供服务的两个不同城市之间旅行的人员的所有可能的飞行计划(假设存在路径)。 对于每个可能的行程,您还将计算所产生的总成本和时间。

所以我们都在同一页面上,让我定义一些术语,希望我能在剩下的文章中保持一致。

● 始发城市 – 航班起飞的城市
● 目的地城市 – 我们想要到达的地方
● 行程 – 从始发城市到目的地城市的一组航班
● 航程 – 行程中的一次航班。

将有两个输入文件。

出发地和目的地数据 – 该文件将包含一系列代表 0 经停航班的城市对,可用于准备飞行计划。 对于其中每一个,该文件还将包含该航段的美元成本和旅行时间。 对于文件中的每一对,您可以假设可以双向飞行。

请求的航班 – 该文件将包含一系列出发地/目的地城市对。 对于每一对,您的程序将确定航班是否可行。 如果可能,它会将飞行计划以及飞行总成本输出到文件中。 如果不可能,则会将合适的消息写入输出文件。

两个输入文件以及输出文件的名称将通过命令行参数提供。