import java.util.Scanner;
class bank{
public void termDeposit(){
int principle;
double rate,years;
Scanner sc=new Scanner(System.in);
System.out.print("Enter Principle Amount : ");
principle = sc.nextInt();
System.out.print("Enter rate od interest : ");
rate = sc.nextDouble();
System.out.print("Enter time period in years : ");
years = sc.nextDouble();
double maturityAmount = (principle*(Math.pow(1+(rate/100),years)));
System.out.println("Maturity Amount after " +years+ " years is : "+maturityAmount);
}
public void reccuringDeposit(){
int monthlyInstallmentPayment,months;
double rate;
Scanner sc=new Scanner(System.in);
System.out.print("Enter Monthly payment : ");
monthlyInstallmentPayment=sc.nextInt();
System.out.print("Enter Number of months : ");
months=sc.nextInt();
System.out.print("Enter rate of interest : ");
rate=sc.nextDouble();
double maturityAmount = ((monthlyInstallmentPayment*months)+(monthlyInstallmentPayment*(months*((months+1)/100)))*(rate/100)*(1/12));
System.out.println("Maturity Amount after " +months+ " months is : " +maturityAmount);
}
}
public class Bank{
public static void main(String[]args){
System.out.println("Press 1 : Term Deposit. ");
System.out.println("Press 2 : Reccuring Deposit. ");
Scanner sc=new Scanner(System.in);
int ch=sc.nextInt();
switch(ch){
case 1:
Bank obj=new Bank();
obj.termDeposit();
break;
case 2:
Bank obj1=new Bank();`
obj1.reccuringDeposit();
break;
default :
System.out.println("WRONG CHOISE");
}
}
}
sujoy98 0 Newbie Poster
Aisha_8 0 Newbie Poster
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
bdux 0 Newbie Poster
zolymo 12 Newbie
sujoy98 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.