CNET-142- Introduction to Python Your program should have work similar to the one below: CNET-142: Ron Sha, Lab4 Menu Function 2020-09-12 09:48:29.666729 1 2 99 Calculate Simple Interest Calculate Mortgage Payment Quit the program Select one of the command number above: As one of the selection, enter 10. Since it is not a valid menu selection, you must ask user to re-enter selection. 1 Calculate Simple Interest 2 Calculate Mortgage Payment 99 Quit the program Select one of the command number above: 10 Error: command not recognized Select one of the command number above: If you selected choice 1, the program will call the "Calculate Simple Interest" function to do the following: Use the same number as the test case to calculate the interest rate. You MUST use the test cases (highlighted in yellow) stated in this assignments. 1 Calculate Simple Interest 2 Calculate Mortgage Payment 99 Quit the program 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Question
For python, do the following
CNET-142- Introduction to Python
Your program should have work similar to the one below:
CNET-142: Ron Sha, Lab4 Menu Function
2020-09-12 09:48:29.666729
1
2
99
Select one of the command number above:
Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
As one of the selection, enter 10. Since it is not a valid menu selection, you must ask user to re-enter selection.
1
2
99
Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
Select one of the command number above: 10
Error: command not recognized
Select one of the command number above:
1
2
99
If you selected choice 1, the program will call the "Calculate Simple Interest" function to do the following: Use the
same number as the test case to calculate the interest rate.
You MUST use the test cases (highlighted in yellow) stated in this assignments.
Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
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
Transcribed Image Text:CNET-142- Introduction to Python Your program should have work similar to the one below: CNET-142: Ron Sha, Lab4 Menu Function 2020-09-12 09:48:29.666729 1 2 99 Select one of the command number above: Calculate Simple Interest Calculate Mortgage Payment Quit the program As one of the selection, enter 10. Since it is not a valid menu selection, you must ask user to re-enter selection. 1 2 99 Calculate Simple Interest Calculate Mortgage Payment Quit the program Select one of the command number above: 10 Error: command not recognized Select one of the command number above: 1 2 99 If you selected choice 1, the program will call the "Calculate Simple Interest" function to do the following: Use the same number as the test case to calculate the interest rate. You MUST use the test cases (highlighted in yellow) stated in this assignments. Calculate Simple Interest Calculate Mortgage Payment Quit the program 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
CNET-142- Introduction to Python
Lab4 - Functions - CNET-142
Your name must include program description,
For this lab, we will use functions and imported functions to write a calculation program to do the following:
For every lab, you must print out your name and time when you run your program at the beginning of
your program (similar to your lab 1).
O
Write a program that do the following unit conversion based on user menu selection: (use while
loop until the user enter '99' selection to Quit)
O
1. Calculate Interest Rate
2. Calculate Mortgage
99 Quit
1
2
99
Calculate Simple Interest
Calculate Mortgage Payment
Quit the program
Select one of the command number above:
O
If user choice selection 1, then calculate interest rate. Modify your interest rate lab program
to be a function. Save this program to simple_interest.py filename in the current lab folder.
Use import to include the function in your main program.
O
If user choice selection 2, then calculate mortgage. For this, you need to write a python
program function that will calculate mortgage payment. Save the program to mortgage.py
filename. You can modify the interest program with the following formulate:
1. How to calculate mortgage payment: (You MUST use the following test cases)
Assume loanAmount = $100,000
Assume interestRate = 3.25%
Assume loanTerm = 15 years
Then formula for mortgage calculation is:
monthlyRate = (interestRate/100)/12
numPayments = loanTerm * 12
monthly Payment = loanAmount * monthlyRate\
* pow((1 + monthly Rate), numPayments) |
/(pow((1 + monthlyRate), num Payments) - 1)
totalPayment = monthlyPayment * (loan Term * 12)
interest Paid = totalPayment - loanAmount
monthly Payment would be: $702.67
totalPayment would be: $126,480.38
interest Paid would be: $26,480.38
Transcribed Image Text:CNET-142- Introduction to Python Lab4 - Functions - CNET-142 Your name must include program description, For this lab, we will use functions and imported functions to write a calculation program to do the following: For every lab, you must print out your name and time when you run your program at the beginning of your program (similar to your lab 1). O Write a program that do the following unit conversion based on user menu selection: (use while loop until the user enter '99' selection to Quit) O 1. Calculate Interest Rate 2. Calculate Mortgage 99 Quit 1 2 99 Calculate Simple Interest Calculate Mortgage Payment Quit the program Select one of the command number above: O If user choice selection 1, then calculate interest rate. Modify your interest rate lab program to be a function. Save this program to simple_interest.py filename in the current lab folder. Use import to include the function in your main program. O If user choice selection 2, then calculate mortgage. For this, you need to write a python program function that will calculate mortgage payment. Save the program to mortgage.py filename. You can modify the interest program with the following formulate: 1. How to calculate mortgage payment: (You MUST use the following test cases) Assume loanAmount = $100,000 Assume interestRate = 3.25% Assume loanTerm = 15 years Then formula for mortgage calculation is: monthlyRate = (interestRate/100)/12 numPayments = loanTerm * 12 monthly Payment = loanAmount * monthlyRate\ * pow((1 + monthly Rate), numPayments) | /(pow((1 + monthlyRate), num Payments) - 1) totalPayment = monthlyPayment * (loan Term * 12) interest Paid = totalPayment - loanAmount monthly Payment would be: $702.67 totalPayment would be: $126,480.38 interest Paid would be: $26,480.38
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education