Write a
program to find and display the
simple interest and amount using scanner
class functions. Enler the required input
values
principal rate
and time periods
Answers
Answer:
__________________
import java.util .*;
class InputDemo
{
public static void main (String args [ ])
{
double p, n, r,si,ci;
Scanner s=new Scanner (System. in);
System.out.println("Enter the amount:");
p=s.nextDouble( );
System. out. println("Enter the No.of years:");
n=s.nextDouble( );
System. out. println("Enter the Rate of interest");
r=s.nextDouble( );
si=(p*n*r)/100;
ci=p*Math.pow(1.0+r/100.0,n)-p;
System.out. println(" Amount="+p );
System. out. println("N o. of years="+n);
System. out. println("Rate of interest="+r);
System.out.println("Simple Interest="+si);
System.out. println("Compound Interest="+ci);
}
}
Look at the page above for your answer
It may help you.