This task is where the profit and loss is calculated for the flight - We have already done most of the work for this in getting the data ready.
The first tasks on here are to check the data that should have already been entered in other tasks.
a) Check there is a code in UK and Overseas Airport
b) Check that an aircraft type has been entered
c) check if a number of first class seats has been entered
d) check the flight range of the aircraft against the distance from one airport (LPL or BOH) to the International destination airport - the plane needs to have enough range to reach the destination.
The code below checks each in turn against the Global Variables that we have already stored the data into - If there is anything in these variables then the data should already be correct as we checked what was input at the time it was added.
When all of those things are checked then we can start to enter data.
Data entry is part e
calculation of profit is part f
display to the user the results is part g
This is the last part of the program - you will need to test it with some data that you know the result to - so work out by hand a flight and profit then run with the same data to check.
This kind of testing is called use case testing.
You may decide to make your program a bit more user friendly by making the output easier to see etc. - I have not helped the user much in their data input especially with the entering of the aircraft - I could change it to offer the user an option instead of having to type in "Medium narrow body" etc.
Running the Program
The code below is the last code on my program - i.e. where the program begins.
The global variables here are used in all the work we have done so far on making the program.