Java program to calculate simple interest using constructor overloading for attributes like principal rate and time
Sign up to join our community!
Please sign in to your account!
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
package javaapplication1;
import java.util.*;
class amount
{
double amount;
double intrest;
int year;
amount(double a, double i)
{
a=amount;
i=intrest;
int y=year=5;
double s_intrest;
}
}
public class Main
{
public static void main(String[] args)
{
double a,i,s_intrest;
int y=5;
Scanner s=new Scanner(System.in);
a=s.nextDouble();
i=s.nextDouble();
amount a1=new amount(a,i);
s_intrest=(a*i*y)/100;
System.out.println(s_intrest);
}
}