Write a program that do the following unit conversion based on user menu selection in python: (use while loop until the user enter ‘99’ selection to Quit) 1. Calculate Interest Rate 2. Calculate Mortgage 99 Quit If the user selects 1, then calculate interest rate. Create a python function that will continuously ask the user for inputs to calculate interest earned until the user enters a number 0 (zero) in principle. Once the user enters any number less than or equal to 0 in principle, the program will exit. The program should use while loop to ask the user for inputs.  Assume the following variables: p is the initial principle balance r is the annual interest rate n is the amount of times the interest compounds in a year t is the number of years To calculate balance the formula used should be: total = p*(1+float(r/100)/n)**(n*t) interest = total - p Use import to include this function in the main program. If user choice selection 2, then calculate mortgage. For this, you need to write another separate python program function that will calculate mortgage payment that will be imported in. You can modify the interest program with the following formulate: The formula to calculate mortgage payment should be: monthlyRate = (interestRate / 100) / 12 numPayments = loanTerm * 12 monthlyPayment = loanAmount * monthlyRate \ * pow((1 + monthlyRate), numPayments) \ / (pow((1 + monthlyRate),numPayments) - 1) totalPayment = monthlyPayment * (loanTerm * 12) interestPaid = totalPayment - loanAmount If the user enters a number in the main menu that is not a valid menu selection, the program should ask the user to select one of the command numbers above. After finishing calculating something, the program should be able to calculate another set of numbers for the same task unless the user enters 0, where the program will then exit to the main menu. The program should look as it does in the images

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a program that do the following unit conversion based on user menu selection in python: (use while loop until the user enter ‘99’ selection to Quit)
1. Calculate Interest Rate
2. Calculate Mortgage
99 Quit

If the user selects 1, then calculate interest rate. Create a python function that will continuously ask the user for inputs to calculate interest earned until the user enters a number 0 (zero) in principle. Once the user enters any number less than or equal to 0 in principle, the program will exit. The program should use while loop to ask the user for inputs. 

Assume the following variables:

  • p is the initial principle balance
  • r is the annual interest rate
  • n is the amount of times the interest compounds in a year
  • t is the number of years

To calculate balance the formula used should be:

  • total = p*(1+float(r/100)/n)**(n*t)
  • interest = total - p

Use import to include this function in the main program.

If user choice selection 2, then calculate mortgage. For this, you need to write another separate python program function that will calculate mortgage payment that will be imported in. You can modify the interest program with the following formulate:

The formula to calculate mortgage payment should be:
monthlyRate = (interestRate / 100) / 12
numPayments = loanTerm * 12
monthlyPayment = loanAmount * monthlyRate \
* pow((1 + monthlyRate), numPayments) \
/ (pow((1 + monthlyRate),numPayments) - 1)
totalPayment = monthlyPayment * (loanTerm * 12)
interestPaid = totalPayment - loanAmount

If the user enters a number in the main menu that is not a valid menu selection, the program should ask the user to select one of the command numbers above.

After finishing calculating something, the program should be able to calculate another set of numbers for the same task unless the user enters 0, where the program will then exit to the main menu.

The program should look as it does in the images.

 

Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
2
99
Select one of the command number above: 2
Enter the loan amount, 0 to quit: 150000
Enter the loan interest rate % : 2.85
Enter the loan term (number of years): 30
For the loan Amount of $150,000.00 for 30 years with interest rate of 2.85 %
The monthly payment is $620.34
Total amount paid for this loan is $223,320.99
Total interest paid for this loan is $73,320.99
Enter the loan amount, 0 to quit: 200000
Enter the loan interest rate : 2.5
Enter the loan term (number of years): 15
For the loan Amount of $200,000.00 for 15 years with interest rate of 2.50 %
The monthly payment is $1,333.58
Total amount paid for this loan is $240,044.12
Total interest paid for this loan is $40,044.12
Enter the loan amount, 0 to quit:
Enter the loan amount, 0 to quit: 0
Existing Mortgage program
1
2
Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
99
Select one of the command number above: 99
Have a nice day...
Transcribed Image Text:Calculate Simple Interest Calculate Mortgage Payment Quit the program 2 99 Select one of the command number above: 2 Enter the loan amount, 0 to quit: 150000 Enter the loan interest rate % : 2.85 Enter the loan term (number of years): 30 For the loan Amount of $150,000.00 for 30 years with interest rate of 2.85 % The monthly payment is $620.34 Total amount paid for this loan is $223,320.99 Total interest paid for this loan is $73,320.99 Enter the loan amount, 0 to quit: 200000 Enter the loan interest rate : 2.5 Enter the loan term (number of years): 15 For the loan Amount of $200,000.00 for 15 years with interest rate of 2.50 % The monthly payment is $1,333.58 Total amount paid for this loan is $240,044.12 Total interest paid for this loan is $40,044.12 Enter the loan amount, 0 to quit: Enter the loan amount, 0 to quit: 0 Existing Mortgage program 1 2 Calculate Simple Interest Calculate Mortgage Payment Quit the program 99 Select one of the command number above: 99 Have a nice day...
Calculate simple Interest
Calculate Mortgage Payment
Quit the program
1
2
99
Select one of the command number above:
Calculate simple Interest
Calculate Mortgage Payment
Quit the program
2
99
Select one of the command number above: 10
Error: command not recognized
Select one of the command number above:
Calculate simple Interest
2 Calculate Mortgage Payment
Quit the program
99
select one of the command number above: 1
Calculating Simple Interest
Enter the starting principal, <= 0 to quit: 1000
Enter the annual interest rate : 3.5
How many times per year is the interest compounded? 365
For how many years will the account earn interest? 1
At the end of 1.0 years you will have$ 1,035.62 with interest earned $ 35.62
Enter the starting principal, <= 0 to quit: 0
Existing Simple Interest program
Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
1
2
99
Select one of the command number above:
Transcribed Image Text:Calculate simple Interest Calculate Mortgage Payment Quit the program 1 2 99 Select one of the command number above: Calculate simple Interest Calculate Mortgage Payment Quit the program 2 99 Select one of the command number above: 10 Error: command not recognized Select one of the command number above: Calculate simple Interest 2 Calculate Mortgage Payment Quit the program 99 select one of the command number above: 1 Calculating Simple Interest Enter the starting principal, <= 0 to quit: 1000 Enter the annual interest rate : 3.5 How many times per year is the interest compounded? 365 For how many years will the account earn interest? 1 At the end of 1.0 years you will have$ 1,035.62 with interest earned $ 35.62 Enter the starting principal, <= 0 to quit: 0 Existing Simple Interest program Calculate Simple Interest Calculate Mortgage Payment Quit the program 1 2 99 Select one of the command number above:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY