Please Answer this question.
Answers
import java.util.*;
public class CI
{
public static void main (String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Please Enter The Principle Amount");
double P = sc.nextDouble();
System.out.println("Please Enter The Time Span");
double T = sc.nextDouble();
System.out.println();
if (T == 1)
{
double R = 5 ;
double A = P * (Math.pow((1 + (R/100)) , T)) ;
double CI = A - P ;
double V = P + CI ;
System.out.println("Compound Interest on "+P+" at Rate "+R+" and Time "+T+" = "+CI);
System.out.println("Total = "+V);
}
else if (T > 1 && T <= 3)
{
double R = 5.5 ;
double A = P * (Math.pow((1 + (R/100)) , T)) ;
double CI = A - P ;
double V = P + CI ;
System.out.println("Compound Interest on "+P+" at Rate "+R+" and Time "+T+" = "+CI);
System.out.println("Total = "+V);
}
else if (T > 3)
{
double R = 5.25 ;
double A = P * (Math.pow((1 + (R/100)) , T)) ;
double CI = A - P ;
double V = P + CI ;
System.out.println("Compound Interest on "+P+" at Rate "+R+" and Time "+T+" = "+CI);
System.out.println("Total = "+V);
}
sc.close();
}
}