A bank is offering different rate of interest on fixed deposits based on the duration of investment as follows:
TIME : Rate p.a :
Up to 1 year 5%
>1 year up to 3 years 5.5%
>3 years 5.25%
Write a program to assign the principal amount and time if duration (in years) and display the final amount the bank will pay to the customer.
A = P(1+R/100)T
Answers
Explanation:
it is a correct answer this question
import java.util.*;
public class Interest
{
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();
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+" For 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+" For 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+" For Time "+T+" = "+CI);
System.out.println("Total = "+V);
}
sc.close();
}
}