In this assignment you will continue the Flight Search Engin
In this assignment you will continue the Flight Search Engine mini-project by creating additional classes, and practicing logic in arrays. The classes you create must be compatible with either the classes you submitted last week, or our posted solution. Please indicate which in a comment at the top of the classes. Included for you are two simple testing classes that you can use to verify the top-level functionality of your system. Do not submit them.
Q1: [FlightSearchEngine Mini-Project] Create an Itinerary class. This class will represent a travel itinerary containing one or two flights in our system. It should contain two constructors, two instance variables (two different Flights) and seven methods (getFirstFlight, getSecondFlight, hasConnection, getTotalCost, getDeparture, getArrival, toString) [15 points]
overloaded constructor: will take one Flight object and use it to set up the instance variables. The second Flight variable should be set to null.
overloaded constructor: will take two Flight objects and use them to set up the instance variables.
getFirstFlight(): returns the first Flight in the itinerary.
getSecondFlight(): returns the second Flight in the itinerary.
hasConnection(): returns true if the itinerary contains two Flight objects.
getTotalCost(): returns the total cost of all Flights in the itinerary.
getDeparture(): returns the departure time of the first flight in the itinerary.
getArrival(): returns the arrival time of the last flight in the itinerary.
toString(): will return the total cost of the itinerary and the \"detailed string\" for the Flight or Flights in the itinerary.
Sample Output from ItineraryTest.:
Q2: [FlightSearchEngine Mini-Project] Create a FlightManager class. This class will store instances of the Flight class, and support generating a list of potential itineraries. It should contain one constructor, two instance variables (an array of Flights, and something that counts the number of flights in the system), and four methods (addFlight, increaseSize, findItineraries, shrinkItineraries). [25 points]
default constructor: will set up the instances variables with zero flights.
addFlight(...): Adds a flight to the flights array. Uses the increaseSize() method if the array is full.
increaseSize(): Doubles the size of the flights array, while keeping whatever is already there. Make this a private method.
findItineraries(...): Searches the flights based on source airport, destination airport, and departure time, to find 1-flight and 2-flight itineraries meeting those criteria. When searching for 2-flight itineraries, checks that the flights have a connecting city, and that the first arrives in time for the second. Your method should create an array of potential itineraries that can be returned. (If it helps, you may assume that this method will never find more than 100 itineraries.) Use the shrinkItineraries() method to \"clean up\" up the potential itineraries array; see below. Hint: use loops to search for all the flights in the flights variable, check if they meet the criteria, and then create a new Itinerary object if the criteria is met.
shrinkItineraries(...). Takes an array of itineraries, where some of the later indices are unused (null), and returns a new array of itineraries where there are no empty indices. Make this a private method.
Sample Output from FlightManagerTest:
Previouse code and the two testing classes.
https://www.dropbox.com/s/tkzjds3sjrg933h/Airline.java?dl=0
https://www.dropbox.com/s/h78zv1hthcvgl04/Airport.java?dl=0
https://www.dropbox.com/s/ximgbkqnntd737u/Driver.java?dl=0
https://www.dropbox.com/s/yhzj1ugtanerm29/Flight.java?dl=0
https://www.dropbox.com/s/ymb3uk1snmezuxv/FlightManagerTest.java?dl=0
https://www.dropbox.com/s/rgcs40uuak8w3s8/ItineraryTest.java?dl=0
https://www.dropbox.com/s/87yhs8zmym8ocor/Plane.java?dl=0
https://www.dropbox.com/s/45xev3exrdo6hwe/Time.java?dl=0
Solution
The NPV of a venture or speculation mirrors how much money inflow, or income, rises to or surpasses the measure of venture capital required to store it. While evaluating numerous tasks, organizations utilize NPV as a method for contrasting their relative benefit with guarantee that exclusive the most lucrative endeavors are sought after. A higher NPV demonstrates that the venture or speculation is more productive.
To figure NPV, the evaluated money surge and inflow for every period must be set up, and in addition the normal rebate rate. In spite of the fact that the correct figures must be known after fruition, reasonable appraisals can be made by taking a gander at the execution of comparable activities or ventures.
NPV = {Net Period Cash Flow/(1+R)^T} - Initial Investment
where R is the rate of return and T is the quantity of eras.
Computing NPV in Excel
While computing NPV for transient undertakings with basic money streams is genuinely direct, numerous activities require extra infusions of capital after beginning and take years to finish. In these cases, computing NPV by hand gets to be wasteful. Nonetheless, the NPV of any speculation or venture can undoubtedly be figured utilizing Microsoft Excel, given that money streams are equitably divided after some time.
To start with, enter the foreseen markdown rate into cell A1. Next, information all money streams successively into neighboring cells, entering any outpouring values as negative numbers. For instance, a venture with a solitary beginning speculation that is relied upon to create returns throughout three years will have four sections in cells A2 through A5. Exceed expectations accept all streams happen toward the end of every period. Along these lines, if the underlying speculation happens at venture initiation as opposed to toward the end of the principal time frame, then this figure should be added to the NPV work independently and excluded in the capacity itself.
In the event that the underlying venture happens toward the end of the main time frame, as the program accept, enter the equation \"=NPV(A1,A2,A3,A4,A5)\" into cell A6 to render the NPV for this venture.
In the event that the underlying speculation happens toward the start of the main time frame rather, enter the recipe \"=NPV(A1,A3,A4,A5)+A2\" to represent that underlying cost.
A Brief Example of NPV
Accept an organization needs to break down the anticipated gainfulness of a venture that requires an underlying cost of $10,000. Through the span of three years, the venture is required to create incomes of $2,000, $7,000 and $11,000, separately. The expected rebate rate is 4.5%. At first look, it appears the profits are about twofold the speculation. Be that as it may, a dollar earned in three years is not as significant as a dollar earned today, so the organization\'s bookkeeper computes the NPV as takes after to decide benefit while representing the reduced time estimation of the anticipated incomes:

