5-4-1 An Amortization Schedule Problem/Specification: Suppose you take out a loan of 81,000 at a yearly interest rate of 10M0 and you intend to repay that loan at $200 (inciuding the interest payment) permonth untii the loan is fully repaid. You would like to have an amortization schedule like the fol- lo wing one: AMORTIZATION TABLE PRINCIPAL $1,000.09 INTEREST 12.00% REGULAR PAYMENT $200.00 NO. INTEREST AMORTIZED BALANCE INTEREST TO DATE 10.00 13.10 2 4.28 28.52 30.81 31.12 810.00 618.19 424.23 228.52 30.81 0.90 19.090 8.10 6.18 4.24 2.29 0.31 199.07 191.99 193.82 195.76 197.71 39.81 1 2 4 LAST PAYMENT = $ 31.12 Write a program to read a loan principal, an interest rate, and a monthly repayment amount and generate an amortization table like the one above. AMORTIZATION TABLE PRINCIPAL: $1000 .0 INTEREST: 12.0% REGULAR PAYMENT $200.0 NO. INTEREST AMORTIZED BALANCE INTEREST TO DATE 1 10.00 190.00 810.00 10.00 2 8.10 191.90 618.10 18.10 3 6.18 193.82 424.28 24.28 4.24 28.52 4 195.76 228.52 2.29 197.71 30.81 30.81 6 0.31 199.69 0.00 31.12

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
icon
Related questions
Question

Hello, I am a novice working with Java. I am creating an amortization schedule (pictured below) and have run into an issue. As visible in the example, everything but the final "Amortized" value on the chart is functional. Why is this and how do I fix it? 

 

I believe this may be tied to my "monthint" value and how it handles the "balance" value. Perhaps it's directly tied to my logic behind the "amorized" variable in the loop?

--------------------------------------------------------------------------------

import java.util.Scanner;
public class taxAmortization {
public static void main(String[] args) {
Scanner inKey = new Scanner(System.in);
double principal,interest,repay,monthint,amorized,intdate,balance,finalbal;
int month;


System.out.println("What is the principal on your loan?");
principal = inKey.nextDouble();

System.out.println("What is the interest rate on your loan? (In percent)");
interest = inKey.nextDouble();

System.out.println("What is your monthly loan payment?");
repay = inKey.nextDouble();

intdate = 0;
month = 0;
finalbal = 0;
balance = principal;


System.out.println("\t\t\t\t AMORTIZATION TABLE\n\t\tPRINCIPAL: $" + principal + " INTEREST: " + interest + "% \n\t\t\t REGULAR PAYMENT $" + repay + "\n NO.\tINTEREST\tAMORTIZED\tBALANCE\t INTEREST TO DATE");
while (balance > 0) {
month = month+1;
monthint = ((interest / 100)/12) * balance;
amorized = repay - monthint;
balance = balance - amorized;
intdate = intdate + monthint;
if (balance > 0) {
finalbal = balance;
}
else{
finalbal = 0;
}
System.out.printf(" %d\t\t%.2f\t %.2f\t %.2f\t %.2f",month,monthint,amorized,finalbal,intdate);
System.out.println();
}
}
}

----------------------------------------------------------------------------------

5-4-1 An Amortization Schedule
Problem/Specification: Suppose you take out a loan of 81,000 at a yearly interest rate of
10M0 and you intend to repay that loan at $200 (inciuding the interest payment) permonth
untii the loan is fully repaid. You would like to have an amortization schedule like the fol-
lo wing one:
AMORTIZATION TABLE
PRINCIPAL $1,000.09 INTEREST 12.00%
REGULAR PAYMENT $200.00
NO.
INTEREST AMORTIZED
BALANCE INTEREST TO DATE
10.00
13.10
2 4.28
28.52
30.81
31.12
810.00
618.19
424.23
228.52
30.81
0.90
19.090
8.10
6.18
4.24
2.29
0.31
199.07
191.99
193.82
195.76
197.71
39.81
1
2
4
LAST PAYMENT = $ 31.12
Write a program to read a loan principal, an interest rate, and a monthly repayment
amount and generate an amortization table like the one above.
Transcribed Image Text:5-4-1 An Amortization Schedule Problem/Specification: Suppose you take out a loan of 81,000 at a yearly interest rate of 10M0 and you intend to repay that loan at $200 (inciuding the interest payment) permonth untii the loan is fully repaid. You would like to have an amortization schedule like the fol- lo wing one: AMORTIZATION TABLE PRINCIPAL $1,000.09 INTEREST 12.00% REGULAR PAYMENT $200.00 NO. INTEREST AMORTIZED BALANCE INTEREST TO DATE 10.00 13.10 2 4.28 28.52 30.81 31.12 810.00 618.19 424.23 228.52 30.81 0.90 19.090 8.10 6.18 4.24 2.29 0.31 199.07 191.99 193.82 195.76 197.71 39.81 1 2 4 LAST PAYMENT = $ 31.12 Write a program to read a loan principal, an interest rate, and a monthly repayment amount and generate an amortization table like the one above.
AMORTIZATION TABLE
PRINCIPAL: $1000 .0
INTEREST: 12.0%
REGULAR PAYMENT $200.0
NO.
INTEREST
AMORTIZED
BALANCE
INTEREST TO DATE
1
10.00
190.00
810.00
10.00
2
8.10
191.90
618.10
18.10
3
6.18
193.82
424.28
24.28
4.24
28.52
4
195.76
228.52
2.29
197.71
30.81
30.81
6
0.31
199.69
0.00
31.12
Transcribed Image Text:AMORTIZATION TABLE PRINCIPAL: $1000 .0 INTEREST: 12.0% REGULAR PAYMENT $200.0 NO. INTEREST AMORTIZED BALANCE INTEREST TO DATE 1 10.00 190.00 810.00 10.00 2 8.10 191.90 618.10 18.10 3 6.18 193.82 424.28 24.28 4.24 28.52 4 195.76 228.52 2.29 197.71 30.81 30.81 6 0.31 199.69 0.00 31.12
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
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.
Similar questions
  • SEE MORE QUESTIONS
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