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...


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<br>Calculate Mortgage Payment<br>Quit the program<br>2<br>99<br>Select one of the command number above: 2<br>Enter the loan amount, 0 to quit: 150000<br>Enter the loan interest rate % : 2.85<br>Enter the loan term (number of years): 30<br>For the loan Amount of $150,000.00 for 30 years with interest rate of 2.85 %<br>The monthly payment is $620.34<br>Total amount paid for this loan is $223,320.99<br>Total interest paid for this loan is $73,320.99<br>Enter the loan amount, 0 to quit: 200000<br>Enter the loan interest rate : 2.5<br>Enter the loan term (number of years): 15<br>For the loan Amount of $200,000.00 for 15 years with interest rate of 2.50 %<br>The monthly payment is $1,333.58<br>Total amount paid for this loan is $240,044.12<br>Total interest paid for this loan is $40,044.12<br>Enter the loan amount, 0 to quit:<br>Enter the loan amount, 0 to quit: 0<br>Existing Mortgage program<br>1<br>2<br>Calculate Simple Interest<br>Calculate Mortgage Payment<br>Quit the program<br>99<br>Select one of the command number above: 99<br>Have a nice day...<br>

Extracted 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<br>Calculate Mortgage Payment<br>Quit the program<br>1<br>2<br>99<br>Select one of the command number above:<br>Calculate simple Interest<br>Calculate Mortgage Payment<br>Quit the program<br>2<br>99<br>Select one of the command number above: 10<br>Error: command not recognized<br>Select one of the command number above:<br>Calculate simple Interest<br>2 Calculate Mortgage Payment<br>Quit the program<br>99<br>select one of the command number above: 1<br>Calculating Simple Interest<br>Enter the starting principal, <= 0 to quit: 1000<br>Enter the annual interest rate : 3.5<br>How many times per year is the interest compounded? 365<br>For how many years will the account earn interest? 1<br>At the end of 1.0 years you will have$ 1,035.62 with interest earned $ 35.62<br>Enter the starting principal, <= 0 to quit: 0<br>Existing Simple Interest program<br>Calculate Simple Interest<br>Calculate Mortgage Payment<br>Quit the program<br>1<br>2<br>99<br>Select one of the command number above:<br>

Extracted 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: 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="">

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here