Recent Question/Assignment

An airline company has three classes for its international flights: First class, Business class and Economy class. Write a program that will ask the user to enter the flight number, number of tickets sold of each flight class. Respective ticket prices of each flight class are $1,000, $900 and $800. 10% of any sales value is allocated for Goods and Services Tax (GST). Finally, the program will display the amount of money earned for each class and the total amount of money earned for all three classes together. Then, the program should prompt the user with the message “Do you wish to repeat for another flight? [Y/N]: “. If the user selects ‘Y’ or ‘y’ the program should repeat. If the user selects ‘N’ or ‘n’ the program should terminate and print ‘Thank You! ------ See You Again!’

Write an algorithm in structured English (pseudocode) that describes the steps required to perform the task specified. You may specify the algorithm for the functions separately and refer to the function name in the algorithm for the main program. Your program design should include constants, selections, repletion and multiple functions.

Specify 3 sets of test data that will demonstrate the correct ‘normal’ operation of your program. Select another 2 sets of test data that will demonstrate the ‘abnormal’ operation of your program. Set these out in the same format as in Assignment 1.

Implement your algorithm in Python.

Use separate functions to perform the task, instead of having only one single main function.
The ‘main’ function should prompt for user input and then call other function/s that calculates the income generated. Make sure your program has both a ‘main’ function and at least one other function that is called from the ‘main’ function to calculate the income. Remember to call the ‘main’ function at the bottom of your program or it will not execute.

Use triple quoted ‘docstrings’ to document your function, and add other ‘end of line’ comments as necessary to explain your code.

Run your program using the test data you have selected and save the output it produces in a text file.

1. Your algorithm.
2. The table recording your chosen test data.
3. Source code for your Python implementation.
4. Output listings demonstrating the results of using the test data.

It is important that the output listings are not edited in any way.
You MUST prepare and present all source code, output from test runs, and other documentation as separate files within a single directory (folder) identified by your name. This directory will later be compressed into a single ZIP file - see the -Requirements- section below.

The Python source code you write should be saved with a name such as by choosing File Save As, from the IDLE -edit- window.
The test run (or runs) produced when your Python program executes should be saved with a name such as ITC106_Ass_1.txt by choosing File Save As, from the IDLE -run- window. (N.B. When testing your final program, start with a new (empty) run window, perform ALL necessary test runs one after the other, then when finished save the contents of the -run- window into ONE file showing ALL test runs in the order that you carried them out. This order should match the order of the test in your -test data table-).
The other documentation (such as your pseudocode, and your table of test data etc.) should be saved in a Word document with a name such as ITC106_Ass_1.doc.
Thus your directory for Assignment A1 will contain three files - and be identified with your name (and not the name of the subject or the assignment).
It is critically important that your test runs (saved as one file with a .txt extension) are unmodified outputs from your program, and that these results should be reproducible by the marker running your saved .py python program in IDLE. In this subject test runs, and python program listings are NOT to be cut and pasted in any form from the IDLE windows. (For example you might be tempted to cut the output from test runs and to paste it into a Word document to create a -pretty- assignment with headers and footers the way you might be used to doing for other subjects. DO NOT DO THIS! The un-edited contents of the -edit- and -run- windows from IDLE is all we want to see in the .py program listing file and the .txt test run file.)

Once you have saved the three files (as described under -Presentation- above) into a single directory identified by your name, you MUST compress that directory into a single ZIP file (and only a ZIP file - not a RAR file or some other compressed file format), as outlined in the section on presentation. Failure to adhere to these requirements will attract a 10% penalty.