PROGRAM 6 : TO FIND COMPOUNDED AMOUNT BY ENTERING CHOICE '1' OR TO FIND RECURRING DEPOSIT FINAL AMOUNT BY ENTERING CHOICE '2'
YOU ARE ASKED TO ENTER THE PRINCIPAL , RATE OF INTEREST AND TIME IN YEARS.
(FOR COMPOUND INTEREST , FORMULA : AMOUNT=PRINCIPAL*(1+RATE/100)^TIME
FOR RECURRING DEPOSIT,FORMULA : AMOUNT = (p * t * 12) + p*((t*12)*((t*12)+1)/2)*(r/100)*(1/12)))
PROGRAM:
import java.util.Scanner;
public class bankdeposit
{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter your choice : 1 for term deposit and 2 for recurring deposit");
int ch = sc.nextInt();
double p , r , t , am;
switch(ch){
case 1: System.out.println("Enter Principal amount:");
p = sc.nextDouble();
System.out.println("Enter Rate of interest:");
r = sc.nextDouble();
System.out.println("Enter Time period in years:");
t = sc.nextDouble();
am = p * Math.pow(1 + (r/100) , t);
System.out.println("The amount is : " + am);
break;
case 2: System.out.println("Enter Principal amount:");
p = sc.nextDouble();
System.out.println("Enter Rate of interest:");
r = sc.nextDouble();
System.out.println("Enter Time period in years:");
t = sc.nextDouble();
am = (p * t * 12) + p*((t*12)*((t*12)+1)/2)*(r/100)*(1/12);
System.out.println("The amount is : " + am);
break;
default: System.out.println("Sorry. Wrong choice");
}
}
}
YOU ARE ASKED TO ENTER THE PRINCIPAL , RATE OF INTEREST AND TIME IN YEARS.
(FOR COMPOUND INTEREST , FORMULA : AMOUNT=PRINCIPAL*(1+RATE/100)^TIME
FOR RECURRING DEPOSIT,FORMULA : AMOUNT = (p * t * 12) + p*((t*12)*((t*12)+1)/2)*(r/100)*(1/12)))
PROGRAM:
import java.util.Scanner;
public class bankdeposit
{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter your choice : 1 for term deposit and 2 for recurring deposit");
int ch = sc.nextInt();
double p , r , t , am;
switch(ch){
case 1: System.out.println("Enter Principal amount:");
p = sc.nextDouble();
System.out.println("Enter Rate of interest:");
r = sc.nextDouble();
System.out.println("Enter Time period in years:");
t = sc.nextDouble();
am = p * Math.pow(1 + (r/100) , t);
System.out.println("The amount is : " + am);
break;
case 2: System.out.println("Enter Principal amount:");
p = sc.nextDouble();
System.out.println("Enter Rate of interest:");
r = sc.nextDouble();
System.out.println("Enter Time period in years:");
t = sc.nextDouble();
am = (p * t * 12) + p*((t*12)*((t*12)+1)/2)*(r/100)*(1/12);
System.out.println("The amount is : " + am);
break;
default: System.out.println("Sorry. Wrong choice");
}
}
}
Calculate interest based on the type of the account and the status of the account holder. The rates of
ReplyDeleteinterest changes according to the amount (greater than or less than 1 crore), age of account holder
(General or Senior citizen) and number of days if the type of account is FD or RD.