Write a program that will output a table of monthly payments from an initial loa
ID: 3595507 • Letter: W
Question
Write a program that will output a table of monthly payments from an initial loan amount over a range of 15 to 30 years in 5 year increments for several different interest rates. This program is an exercise in formatting output. One can compute a monthly payment based on the initial loan amount, annual percentage rate, and loan duration in years. The monthly payment is calculated using this formula: Where m is the monthly payment, P, is the initial loan amount, and r is the monthly interest rate. The monthly interest rate is the annual percentage rate divided by 12; APR/12. The value n is the number of payment periods, n = number of years times 12 months/year. Use these inputs: $100,000.00 (as the initial loan amount) 3% (representing the low annual-interest rate of 3%) 5% (representing the high annual-interest rate of 6%) Your program will calculate and print a table showing the resulting monthly payment based orn the loan amount, loan interest rates, and duration of the loan. The interest rates will be displayed from the low rate to the high rate in increments of 1/2 percent(5%). The duration of the loan will be for periods of 15, 20, 25, and 30 years. Table of monthly payments for a dollar loan amount of $100000.00 Years: 15 20 25 30 3.0% 3.58 4.0% 4.5% 5.0% 5.5% 6.0% xXx. XX xxx.xXExplanation / Answer
class Compound
{
public static void main (String argu[ ])
{
double pr, rate, t, com;
pr=100000;
rate=3;
System.out.println("Years: 15 20 25 30");
System.out.println("==================================================================");
for(int i=0;i<7;i++){
t=15;
System.out.print(rate+"%");
for(int j=0;j<4;j++){
com=pr * Math.pow(1.0+rate/100.0,t) - pr;
System.out. printf(" $%.2f",com);
t=t+5;
}
System.out.println();
rate=rate+(0.5);
}
}
}
/* output:-
Years: 15 20 25 30
==================================================================
3.0% $55796.74 $80611.12 $109377.79 $142726.25
3.5% $67534.88 $98978.89 $136324.50 $180679.37
4.0% $80094.35 $119112.31 $166583.63 $224339.75
4.5% $93528.24 $141171.40 $200543.45 $274531.81
5.0% $107892.82 $165329.77 $238635.49 $332194.24
5.5% $123247.65 $191775.75 $281339.23 $398395.13
6.0% $139655.82 $220713.55 $329187.07 $474349.12
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.