Java代写 | INFO1113 Assignment 1 Flight Scheduler

本次澳洲CS代写的主要内容是使用Java实现一个航班调度程序

Task Description – Flight Scheduler

In this assignment, you will create a Flight Scheduler application in the Java programming language. The program will be a tool for airlines to use to schedule flights between different locations, producing timetable plans, and an easy way to check routing between cities on multiple flights. You must create at least three classes: FlightScheduler, Flight and Location, for which a scaffold and description have been provided to you. The FlightScheduler class will contain the main entry point of the application (static main function).

You are encouraged to ask questions on Ed under the assignments category if you are unsure of the specification – but staff members will not be able to do any coding or debugging in this assignment for you. As with any assignment, make sure that your work is your own, and do not share your code or solutions with other students.

Working on your assignment

You can work on this assignment on your own computer or the lab machines. It is important that you continually back up your assignment files onto your own machine, external drives, and in the cloud.

You are encouraged to submit your assignment on Ed while you are in the process of completing it. By submitting you will obtain some feedback of your progress on the sample test cases provided.

Implementation details

Write a program in Java to implement the Flight Schedular application that accepts input from the user via standard input. The terminal interface allows the user to interact with the program, to give it input and receive output. The available commands are described below in the section ‘Commands’.

There are three main classes you must implement, but you may also create more if you wish. FlightScheduler class

This class will contain the main entry point of your program (static main function) and store links to all the data relevant to the application. It will be a container for the flight schedule, which is made up of a list of Flights. It should also contain a list of Locations.

The flight schedule is only a single week, Monday to Sunday, which repeats. Assume all times are in UTC, so you do not have to account for timezone differences at different locations.

Flight class

The Flight type should contain all data relevant to a particular flight, methods that perform operations on a Flight or multiple Flights. Attributes will be the flight ID, departure time, source and destination locations, capacity, ticket price, number of passengers booked, and anything else you think is relevant.

Flight duration is determined by the distance between the start and end locations, calculated using the Haversine Formula, and assuming the average speed of an aircraft is 720km/h. The initial ticket price is calculated using an average cost of $30, plus 4x the demand coefficient differential between locations, per 100km distance. For example, if the starting location has demand coefficient of -1 and the end has -1, it remains $30 per 100km. If the starting location has -1 and the end has 1, then it’s $38 per 100km. If the starting location has 1 and end has -1, it would be $22 per 100km.

Ticket price changes when the flight starts to fill up. For the first 50% of seats, the price decreases linearly to 80% of its original value by the time the flight is half full. For the next 20% of seats, the price increases linearly back to 100% of its original value. For the last 30% of seats, ticket price increases by an inverse- tan curve to 110% of its original value.

Location class

The Location type should contain all data relevant to a particular location, and methods that perform operations on a Location or multiple Locations. Attributes will be the location name, latitude and longitude coordinates, lists of arriving and departing flights, and a demand coefficient. Location names must be unique (case insensitive). Latitude must be within [-85, 85] and longitude must be within [- 180,180], both in degrees. The demand coefficient is a number between -1 and 1 (inclusive) which represents whether there is a net inflow or outflow of passengers from this location (negative means passengers want to leave, positive means they want to come). It factors into the calculation that determines the ticket price for a particular flight.

Assume each location has only one runway – that is, no flights can be scheduled to arrive or depart within an hour of another at a particular location. Multi-runway airports can be represented by multiple locations in such a system (eg. Heathrow-1, Heathrow-2, etc).

If there is a scheduling conflict, you must check for conflicts in the following order:

 If there is a clashing flight departing within an hour of this flight’s departure time, at the source  If there is a clashing flight arriving within an hour of this flight’s departure time, at the source
 If there is a clashing flight departing within an hour of this flight’s arrival time, at the destination  If there is a clashing flight arriving within an hour of this flight’s arrival time, at the destination

Commands

FLIGHTS – list all available flights ordered by departure time, then departure location name
FLIGHT ADD <departure time> <from> <to> <capacity> – add a flight
FLIGHT IMPORT/EXPORT <filename> – import/export flights to csv file
FLIGHT <id> – view information about a flight (from->to, departure arrival times, current ticket price, capacity, passengers booked)

FLIGHT <id> BOOK <num> – book a certain number of passengers for the flight at the current ticket price, and then adjust the ticket price to reflect the reduced capacity remaining. If no number is given, book 1 passenger. If the given number of bookings is more than the remaining capacity, only accept bookings until the capacity is full.

FLIGHT <id> REMOVE – remove a flight from the schedule
FLIGHT <id> RESET – reset the number of passengers booked to 0, and the ticket price to its original state.

LOCATIONS – list all available locations in alphabetical order
LOCATION ADD <name> <lat> <long> <demand_coefficient> – add a location
LOCATION <name> – view details about a location (it’s name, coordinates, demand coefficient) LOCATION IMPORT/EXPORT <filename> – import/export locations to csv file
SCHEDULE <location_name> – list all departing and arriving flights, in order of the time they arrive/depart DEPARTURES <location_name> – list all departing flights, in order of departure time
ARRIVALS <location_name> – list all arriving flights, in order of arrival time

TRAVEL <from> <to> [sort] [n] – list the nth possible flight route between a starting location and destination, with a maximum of 3 stopovers. Default ordering is for shortest overall duration. If n is not provided, display the first one in the order. If n is larger than the number of flights available, display the last one in the ordering.

can have other orderings:
TRAVEL <from> <to> cost – minimum current cost TRAVEL <from> <to> duration – minimum total duration TRAVEL <from> <to> stopovers – minimum stopovers TRAVEL <from> <to> layover – minimum layover time TRAVEL <from> <to> flight_time – minimum flight time

HELP – outputs this help string. EXIT – end the program.

Travel command

Since the schedule is weekly and wraps around, you need to consider the possibility of a flight arriving on Sunday evening potentially connecting with a flight that departs on Monday morning. As such, you may ignore available seat capacity selecting a flight in a potential route, since it is assumed that the current bookings are only for the current week, and this flight route may be used to show results for travellers in subsequent weeks, looking to make a booking later on. However, the ticket prices and overall route cost should depend on the current booking numbers of each flight, since we are assuming that the current booking demand is a good indicator of future demand, so ticket prices will be similar in the future to what they are now.

The TRAVEL command has 5 potential orderings, detailed below. If the primary sorting property is equal between two flight paths, it will fall back to the following secondary and tertiary sorting properties.

  •   If total cost is equal, sort then by minimum total duration.
  •   If total duration is equal, sort then by minimum current cost. Total duration is the time taken from

    initial departure of the first flight, to finally arriving at the destination.

  •   If number of stopovers is equal, sort then by minimum total duration (and then by minimum cost). Stopovers are intermediary locations travelled to in order to reach the destination.
  •   If layover time is equal, sort then by minimum total duration (and then by minimum cost). Layover time is the time spent waiting at the airport for connecting flights.
  •   If flight time is equal, sort then by minimum total duration (and then by minimum cost). Flight time is the time spent onboard the aircraft while it is flying (ie. total duration excluding layover time).

    The output format of the travel command is composed of the flight plan, with layover times between flights specified, see the examples section below.

    Note: The number of stopovers is the number of intermediary destinations, not including the original starting location and final destination. It is equivalent to the number of flight legs minus 1.

    Also: The nth flight in the order, starts from 0 being the first one.