Project 3 - Airline Management

(To start this project, make a new file on the compiler and use “#include <vector>”) 

You are the CEO of Wolverine Airlines, an international airline based in Detroit Airport (DTW). You have one extra Boeing 777 airplane and plan on using it to start a new route from Detroit. There are 5 different destinations your employees have shortlisted for you: New York, San Francisco, Paris, Hong Kong, and Cape Town. Your job is to use C++ to analyze which route is the best, given the following information. (Fun Fact: The information below is based off actual numbers, but simplified - this should give you a basic idea of how airlines plan their routes and set their ticket prices)

General Information

(Note on load factor: For example, if the load factor is 20%, then 20% of the 420 seats are filled, so there are 84 seats demanded/filled and 336 empty seats on a flight.)


Cost Information

(Note: For example, if my original weight before takeoff (weight including fuel, passengers, aircraft body etc.) is 1000 pounds, landing at Paris costs 0.01*1000=$10, while landing at New York costs 0.012*1000=$12) 


Revenue Information

(Note: These prices are usually found by looking at competing airlines, cost calculations and demand for the route)


Profit Calculations

All units should be in either pounds (lbs.), dollars ($), hours (hrs.) or miles (mi.)

Hint for all the steps below: You may be able to do this exercise with ‘brute force’ but it may be easier to do it by initializing empty vectors for things you want to calculate (e.g. flight time) then use for loops to do the same calculations for each destination and store the result in an appropriate location in the vector. Also, if you are unsure, you can print out the intermediate calculated values to check if they’re reasonable.

Test the report out to make it more readable (use one endl to skip to next line or two endl’s to separate with blank line).

17. Calculate which destination (destination number) has the highest net profit per passenger (NPPP) and which destination has the highest net profit per hour (NPPH). Hint: Initialize 2 ints that store the destination number of the destination that has the highest NPPP and NPPH - set these initially to destination 1 (i.e. values assigned to the ints represent destination 1). Then, using a for loop that loops over all other destinations, compare the NPPP and NPPH of the other destinations to the NPPP and NPPH of the destination stored in the ints. If the NPPP and NPPH of some other destination is larger than the NPPP and NPPH of the destination stored in the int, replace the destination (number) in the respective int with the respective destination number. At the end of the loop, the 2 ints should store the destination numbers of the destinations with the highest NPPP and NPPH.

18. Print out which destination is the best in terms of net profit per passenger (NPPP). 

19. Print out which destination is the best in terms of net profit per hour (NPPH).

20. Most airlines make around $10 to $20 net profit per passenger (NPPP). They also say that long haul flights earn more than short haul flights. Do your results agree with this?

Solution Code & Output:

Extension

21. Optimize your code to make it shorter and more efficient (try to see if you can combine for loops together or use vectors/for loops to make it more efficient)

22. Edit your code so that instead of using the numbers/information provided above, your program asks the user for the destinations’ distance, load factor, landing fee and ticket price. In other words, allow user input for these 4 parameters so that your code can be used for more destinations and your code is more user friendly.