Question: 1 2 . Go back to the future _ value.py file. Then, comment out the get _ number and get _ integer ( ) functions.

12. Go back to the future_value.py file. Then, comment out the get_number and get_integer() functions.
13. Add an import statement that imports the validation module.
14. Modify the code in the main() function so it uses the functions in the validation module
When you completed modifications shown above, then enhance your program so the console will look something like this:
Financial Calculator Options
1. Future Value Calculation
2. Simple Interest Calculation
3. Quit
Choose an option (1-3): 1
monthly investment:0
Entry must be greater than 0 and less than or equal to 1000
Enter monthly investment:100
Enter yearly interest rate:16
Entry must be greater than 0 and less than or equal to 15
Enter yearly interest rate:12
Enter number of years:100
Entry must be greater than 0 and less than or equal to 50
Enter number of years:10
Future Value =23233.91
Financial Calculator Options
1. Future Value Calculation
2. Simple Interest Calculation
3. Quit
Choose an option (1-3): 2
Enter principal amount: 15000
Entry must be greater than 0 and less than or equal to 10000
Enter principal amount: 5000
Enter annual interest rate: 101
Entry must be greater than 0 and less than or equal to 100
Enter annual interest rate: 12
Enter time period (in years): 51
Entry must be greater than 0 and less than or equal to 50
Enter time period (in years): 10
Simple Interest: 6000.0
Financial Calculator Options
1. Future Value Calculation
2. Simple Interest Calculation
3. Quit
Choose an option (1-3): 3
Goodbye!
The new enhancement is Adding a Menu for Multiple Options
15. Display Menu: A function display_menu() is created to show the user the available options (e.g.,"1. Future Value Calculation", "2. Simple Interest Calculation", "3. Quit").
16. Main Loop for Menu: The main() function contains a while loop that runs indefinitely until the user chooses to quit by selecting option "3".
17. Based on the users input, the program uses conditional checks (if-elif-else) to decide which operation to perform.
18. Simple Interest Calculation: Prompts for principal, interest rate, and time (years), then computes simple interest as this:
simple_interest = principal *(interest_rate /100)* years where principal, interest_rate and years are user input values
```
def calculate_future_value(monthly_investment, yearly_interest, years):
# convert yearly values to monthly values
monthly_interest_rate = yearly_interest /12/100
months = years *12
# calculate future value
future_value =0.0
for i in range(months):
future_value += monthly_investment
monthly_interest = future_value * monthly_interest_rate
future_value += monthly_interest
```
return future_value
def main():
choice ="y"
while choice.lower()=="y":
# get input from the user
monthly_investment = float(input("Enter monthly investment:\t"))
yearly_interest_rate = float(input("Enter yearly interest rate:\t"))
years = int(input("Enter number of years:\t\t"))
## get and display future value
future_value = calculate_future_value(
monthly_investment, yearly_interest_rate, years)
print(f"Future value:\t\t\t{round(future_value, 2)}")
print()
** see if the user wants to continue
choice = input("Continue?(y/n): ")
print()
print("8ye!")\(==\)
\(\operatorname{main}()\) main \(": \)
1 2 . Go back to the future _ value.py file.

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 Programming Questions!