Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a program that uses a function named fv ( ) to calculate and output the future values ( future _ value ) given a
Create a program that uses a function named fv to calculate and output the future values futurevalue given a principal amount p rate of interest r and the number of years years as its parameters. The formula for the future value is:
futurevalue p r years
In other words, the function fv has three parameters p r and years.
Additional requirements:
The principal amount p in the function definition has a default value of that is the argument for this parameter is optional
The interest rate r in the function definition has a default value of another optional argument
Note that in a function definition, parameters with default values must appear AFTER parameters without default values.
At the beginning of the program, first use the input function to prompt users for the time period in years.
Use while loop to validate user inputs. If the time period a user inputted is less than print out You must enter a value greater than or equal to Then, prompt the user to enter the time period again. The program execution leaves the loop only when a user entered a value
When calling the function, only provide one argument: which is the time period year the user inputted:
fvyear
In other words, use the default principal value p and interest rate rsee items A and B above for calculating the future value.
F Round the future value to two decimal places.
For example: If you type in a wrong value, you will see a warning message until you enter a value that is greater than or equal to
Please enter the time period in years:
You must enter a value greater than or equal to
Please enter the time period in years:
You must enter a value greater than or equal to
Please enter the time period in years:
Future value after years is
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