Recent Question/Assignment

• Task
An insurance company wants to get a rough estimate of their annual car insurance income. The company has three types of car insurance as: basic, intermediate and comprehensive. Write a program that will ask the user to enter the insurance company name, year, the number of insurance policies sold of each car insurance type. The average insurance premiums of each car insurance policy type are $500, $650 and $800. The above prices include a 10% Goods and Services Tax (GST). Finally, the program should display the amount of annual earned for each car insurance type (excluding the GST) and the total amount of money earned for all the three car insurance types. Then, the program should prompt the user with the message “Do you wish to repeat for another year? [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!’
Notes: you are expected to use selection, repletion and functions in this program.
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.
Submit:
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.
Rationale
Reinforce topic material on simple functions.
Reinforce topic material on decision structures and Boolean logic.