Write a program named Lab9b_Act2.py that will write to a file a list of amortized values for a loan. Specifically, the program should: 1. Prompt the user for an output file name for the data 2. Prompt the user for the amount of the loan (P), the number of months (N) over which the loan will be repaid, and the annual interest rate (i). (Note that i should be a decimal number, not a percentage: 0.025 not 2.5%) 3. Calculate the monthly payment (M) as shown below. Note: J = i/12 P·J M 1 + Note: You should verify your program's calculations: e.g. for P = $100000, N = 60, i = 0.025 the monthly payment should be M = $1774.74 а. 4. Open the output file for writing 5. Write to the output file column headers for the table as comma-separated strings: Month,Total Accrued Interest,Loan Balance 6. Write to the output file the initial values for the month number, the total amount of interest accrued so far, and the amount remaining on the loan, separated by commas: 0, $0.00, $P.pp where P.pp is the initial value of the amount of the loan) 7. For each month, starting with month 1 and ending when the amount remaining on the loan is less than $0.01: www Calculate the accrued interest by multiplying the balance at the beginning of the month by J = i/12 b. Calculate the balance at the end of the month by adding the accrued interest to the beginning balance and subtracting the monthly payment Write to the output file the month number, the total amount of interest accrued so far (to the nearest penny), and the amount remaining on the loan (to the nearest penny), separated by commas (see output format below) а. С. Note: If you write your CSV file correctly, you should be able to open it in a spreadsheet program that can read CSV files (like Excel). You can also check the values themselves using the PMT() function in Excel, e.g. PMT(0.025/12, 60, 100000) = ($1774.74).

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
100%

9b_act2. Please help me answer this in python programming.

Example
Input (bold red is user input)
Enter output file: out.csv
Enter principal amount: 100000
Enter term length (months): 60
Enter annual interest rate: 0.025
Output
out.csv (created by the program)
Month,Total Accrued Interest,Loan Balance
0,$0.00,$100000.00
1,$208.33,$98433.60
...
59, $6480.48, $1771.05
60, $6484.17, $0.00
Transcribed Image Text:Example Input (bold red is user input) Enter output file: out.csv Enter principal amount: 100000 Enter term length (months): 60 Enter annual interest rate: 0.025 Output out.csv (created by the program) Month,Total Accrued Interest,Loan Balance 0,$0.00,$100000.00 1,$208.33,$98433.60 ... 59, $6480.48, $1771.05 60, $6484.17, $0.00
Write a program named Lab9b_Act2.py that will write to a file a list of amortized values for a loan.
Specifically, the program should:
1. Prompt the user for an output file name for the data
2. Prompt the user for the amount of the loan (P), the number of months (N) over which the loan
will be repaid, and the annual interest rate (i). (Note that i should be a decimal number, not a
percentage: 0.025 not 2.5%)
3. Calculate the monthly payment (M) as shown below. Note: J = i/12
M =
N
1-G)"
-(G
+J.
Note: You should verify your program's calculations: e.g. for P = $100000, N = 60,
0.025 the monthly payment should be M = $1774.74
а.
i
4. Open the output file for writing
5. Write to the output file column headers for the table as comma-separated strings:
Month, Total Accrued Interest,Loan Balance
6. Write to the output file the initial values for the month number, the total amount of interest
accrued so far, and the amount remaining on the loan, separated by commas: 0, $0.00, $P.pp
where P.pp is the initial value of the amount of the loan)
7. For each month, starting with month 1 and ending when the amount remaining on the loan is
less than $0.01:
Calculate the accrued interest by multiplying the balance at the beginning of the month
by J = i/12
b. Calculate the balance at the end of the month by adding the accrued interest to the
beginning balance and subtracting the monthly payment
Write to the output file the month number, the total amount of interest accrued so far
(to the nearest penny), and the amount remaining on the loan (to the nearest penny),
separated by commas (see output format below)
а.
С.
Note: If you write your CSV file correctly, you should be able to open it in a spreadsheet program that
can read CSV files (like Excel). You can also check the values themselves using the PMT() function in
Excel, e.g. PMT (0.025/12, 60, 100000)
($1774.74).
Transcribed Image Text:Write a program named Lab9b_Act2.py that will write to a file a list of amortized values for a loan. Specifically, the program should: 1. Prompt the user for an output file name for the data 2. Prompt the user for the amount of the loan (P), the number of months (N) over which the loan will be repaid, and the annual interest rate (i). (Note that i should be a decimal number, not a percentage: 0.025 not 2.5%) 3. Calculate the monthly payment (M) as shown below. Note: J = i/12 M = N 1-G)" -(G +J. Note: You should verify your program's calculations: e.g. for P = $100000, N = 60, 0.025 the monthly payment should be M = $1774.74 а. i 4. Open the output file for writing 5. Write to the output file column headers for the table as comma-separated strings: Month, Total Accrued Interest,Loan Balance 6. Write to the output file the initial values for the month number, the total amount of interest accrued so far, and the amount remaining on the loan, separated by commas: 0, $0.00, $P.pp where P.pp is the initial value of the amount of the loan) 7. For each month, starting with month 1 and ending when the amount remaining on the loan is less than $0.01: Calculate the accrued interest by multiplying the balance at the beginning of the month by J = i/12 b. Calculate the balance at the end of the month by adding the accrued interest to the beginning balance and subtracting the monthly payment Write to the output file the month number, the total amount of interest accrued so far (to the nearest penny), and the amount remaining on the loan (to the nearest penny), separated by commas (see output format below) а. С. Note: If you write your CSV file correctly, you should be able to open it in a spreadsheet program that can read CSV files (like Excel). You can also check the values themselves using the PMT() function in Excel, e.g. PMT (0.025/12, 60, 100000) ($1774.74).
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