Question: 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 (future_value) 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:
future_value = p *((1+(0.01*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 1000(that is, the argument for this parameter is optional).
The interest rate (r) in the function definition has a default value of 2.5(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 1, print out You must enter a value greater than or equal to 1. Then, prompt the user to enter the time period again. The program execution leaves the loop only when a user entered a value >=1.
When calling the function, only provide one argument: which is the time period (year) the user inputted:
fv(year)
**In other words, use the default principal value (p) and interest rate (r)(see 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 1.
Please enter the time period in years: 0
You must enter a value greater than or equal to 1.
Please enter the time period in years: -5
You must enter a value greater than or equal to 1.
Please enter the time period in years: 6
Future value after 6 years is 1159.69

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!