Assignment
Description
In this assignment you will take a coded program and transform it into a program which uses void and value-returning functions. In the folder with these directions is a file called "Program 4.py". You will use this program to start the assignment. If you run the program it asks for input for saving an amount of money, an interest rate for the savings account and the number of years the user wants to save the amount of money. The output re-states the input (with a heading), gives an amortization schedule of the compounded annual interest and then has final output.
Configure this program to:
You will call a value-returning function for the input, in the main program code, after the declaration of the variables. Name this function appropriately and utilize the arguments needed by the function to complete the task for input. Write the function header with the appropriate parameters accepting the arguments from the function call. Move the code for input from the main program into the function (the input is the code which creates the lines in Figure 1 below). Declare any local variables for the function (if any are needed). Return values to the main function and accept these values into the input variables.
Figure 1
Immediately after the input function call in the main code, call a void function for initial output. Name this function appropriately and utilize the arguments needed by the function to complete the task for initial output. Write the function header with the appropriate parameters accepting the arguments from the function call. Move the code for initial output from the main program into the function (the initial output is the code which creates the lines in Figure 2 below). Declare any local variables for the function (if any are needed).
Figure 2
Next, after the function call in the main code for initial output, you will call a value-returning function for the loop. Name this function appropriately and utilize the arguments needed by the function to complete the task for the loop. Write the function header with the appropriate parameters accepting the arguments from the function call. Move the code for the loop from the main program into the function (the loop is the code which creates the lines in Figure 3 below). Declare any local variables for the function (if any are needed). Return values to the main function and accept these values into the appropriate variables.
Figure 3
Within the value-returning loop function call another function to complete the calculations for the variables needed for the loop output. Name this function appropriately and utilize the arguments needed by the function to complete the calculations. Write the function header with the appropriate parameters accepting the arguments from the function call. Move the code for the loop calculations from the loop function into this function (the loop calculation code is in Figure 4 below). Declare any local variables for the function (if any are needed). Return values to the loop function and accept these values into the appropriate variables.
Figure 4
Last call a void function, after the loop function in the main code, for final output. Name this function appropriately and utilize the arguments needed by the function to complete the task for final output. Write the function header with the appropriate parameters accepting the arguments from the function call. Move the code for final output from the main program into the function (the final output is the code which creates the lines in Figure 5 below). Declare any local variables for the function (if any are needed).
Figure 5
Last the main function will need re-configured. The main function is the first function and is the code that declares the variables, calls the input function, the initial output function, the loop function and the final output function (the code that is left over from the main program you started with and the function calls you added (minus the code you moved to the other functions)). Make sure when you configure this code in the function, all indentation is correct. You will then need to finally call the main function as the last line of the whole program.
Format your assignment according to the following formatting requirements:
1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.
2. The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.
3. Also include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.
Attachment:- Program.rar