Loan Payment Calculator in Java: A Practical Assignment

Verified

Added on  2025/04/29

|3
|163
|441
AI Summary
Desklib provides past papers and solved assignments for students. This assignment demonstrates building a loan payment calculator in Java.
Document Page
Analysis:
The program is to be build in java so that the user can calculate the total payment to be
paid every month. The user would provide the value of loan period and loan amount.
There is an increment of 1/8 and interest starts from 5% and ends until 8%.
Design:
User would enter loan amount and time period and the results would be shown in tabular
method in which 3 columns are made for interest rate, monthly payment and total
payment.
Coding:
import java.lang.Math;
import java.util.Scanner;
public class Main{
public static void main( String[] args) {
double loan, year, rate, month, total;
Scanner sc=new Scanner(System.in);
System.out.println(" Loan Amount:");
loan=sc.nextDouble();
System.out.println(" Number of Years:");
year= sc.nextDouble();
System.out.println(" Interest Rate\tMonthly Payment\tTotal Payment");
year=year*12;
for(double i=5;i<=8;i=i+ 0.25)
{double denominator=0;
double numerator=0;
month=0;
total=0;
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
rate=i;
System.out.print(rate + "%\t\t");
rate=rate/12;
numerator= loan*(rate/100);
rate =1+rate/100;
denominator=(1- 1/Math.pow(rate,year));
month=numerator/denominator;
System.out.print(month+"\t");
total= month*year;
System.out.println(total);
}
}
}
Output screenshot:
Document Page
Testing:
The program is tested with different values and parameters.
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]