Loan Payment Calculator in Java: A Practical Assignment
VerifiedAdded 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.

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;
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;
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

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:
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:

Testing:
The program is tested with different values and parameters.
The program is tested with different values and parameters.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 3
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.