import java.util.Scanner;
class bank{
    public void termDeposit(){
        int principle;
        double rate,years;
        Scanner sc=new Scanner(;
        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.out.print("Enter Monthly payment : ");
        System.out.print("Enter Number of months : ");
        System.out.print("Enter rate of interest : ");
        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(;
        int ch=sc.nextInt();
            case 1:
                Bank obj=new Bank();

            case 2:
                Bank obj1=new Bank();`

            default :
                System.out.println("WRONG CHOISE");
Faheem_1 commented: +0

Tried putting it ilike: case '1': then curly brackets after : and after the break statement? Also default:{ sentence...}
I'm just a newbie so I'm not sure

You have a single quote at the end of line 43.

For the corect syntax of a switch, with examples, see the Oracle tutorial page here

ps: You keep creating new instances of Scanner. That can cause problems with text buffers getting lost. Just create one instance when the program starts, and use that for everything.

1. There is a stray apostrphe at the end of line 43.
2. I changed public class Bank -> public class Main
3. I moved public class Main to the top starting from line 2
4. In the switch statement you try to instantiate a new instance of "Bank" instead of "bank"
    on lines 38 and 42

After correcting these the code compiles and runs.

  1. The class bank is bad defined, u need follow the code conventions; when u define a class write the first letter in Uppercase, for example Bank. If u need test the method, can define the method main inside of the class Bank.
  2. u have an special character in this code at the end of line 43 (maybe is an copy error)

Thanks for all the help, fixed some newbie error now its doing good!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.