Like Us Like Us Facebook Subscribe Subscribe us YouTube Whatsapp Share us Whatsapp Query Send your queries

How to make a Simple Interest Calculator using Java

How to make a Simple Interest Calculator using Java

Today I am going to use Java to make a command line application called Simple Interest Calculator with working example. Code was written by my Student Abhijit [doing Bsc (Computer science)].

Simple Interest Formula

SI = PRT/100N
where P= Principle, R=Rate (Annual) ,T= Time Period, N= Frequency of calculation in one year.

Screen shot

simple -interest

Simple Interest Java Code :

[java]
import java.util.Scanner;
/*
* By Abhijit Prasad (Student)
* Simple Interest Calculator
*/
class SimpleInterest{
public static void main(String args[]){
double pr, ra;
int t, n;
Scanner inp = new Scanner(System.in);
System.out.println(“Enter the Principle: “);
pr= inp.nextDouble();
System.out.println(“Enter the Rate: “);
ra = inp.nextDouble();
System.out.println(“Enter the Time Period: “);
t=inp.nextInt();
System.out.println(“Enter the Frequency: “);
n=inp.nextInt();
double si=pr*ra*t;
si /= n*100;
System.out.println(“Calculated S.I. “+si);
}
}
[/java]

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments