Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your task is to , one last time, modify the code above so that it is more explicit and understandable. There is one file used
Your task is to one last time, modify the code above so that it is more explicit and understandable. There is one file used in this task You will be making changes to this file. Start your work by opening the file in your Visual Studio Code. Find the line in the To complete assign the following constants with the values as indicated. First, define constants for the initial principal that is deposited to the account and the number of years it will be kept there. Name the constants INITIALPRINCIPAL and YEARS respectively. Assign them with the values of and Define constants for the interest rates associated with each account with the following names: ACCOUNTRATE ACCOUNTRATE and ACCOUNTRATE Assign them with the following values: and Define constants for the yearly compounding frequency with the following names: ACCOUNTCMPFREQ ACCOUNTCMPFREQ and ACCOUNTCMPFREQ Assign them with the following values: and In TODO you will implement the amountafternyears function with the initprincipal, accrate, acccmpfreq, and years parameters. The function returns the amount that is going to be on the account after the specified number of years based on the provided parameters. You will be using the following formula:
APrnn t
A : final amount P: initial principal balance r : interest rate n : number of times interest applied per time period acccmpfreq t : number of time period elapsed For more details, please, refer to this tutorial. In TODO you will define amount variables altogether and assign each with the value returned by the amountafternyears. For each variable, the amountafternyears function call needs to be provided with the matching arguments from constants defined in TODO For example, the correct assignment to the amount variable looks like this:
amount amountafternyears INITIALPRINCIPAL, ACCOUNTRATE; ACCOUNTCMPFREQ YEARS
Finally, in TODO replace the existing print statements with the more informative ones that are currently commented out, ie marked with the # prefix. You are required to go about this by commenting out the original two print statements by adding # at the beginning.. Then, uncomment the lines that are originally commented out by removing # at the beginning. Note that you cannot just delete the two original print statements that would result in you not obtaining the full score for this activity.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started