Skip to content

Commit

Permalink
add BankAcc.java
Browse files Browse the repository at this point in the history
  • Loading branch information
mspatel18 authored Feb 7, 2023
1 parent 692a04e commit 464e037
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Sem4/BankAcc.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import java.util.Scanner;
public class BankAcc {
private static int acc =1;
private String name;
private long acc_no;
private String acc_type;
private double acc_balance;
public void CreateAcc(){
Scanner sc = new Scanner(System.in);
acc_no = acc;
acc++;
System.out.println("Your acc no is: " + acc_no);
System.out.println("Enter acc holder name: ");
name = sc.nextLine();
System.out.println("Enter acc type:");
acc_type =sc.nextLine();
//System.out.println("Enter acc balance:");
//acc_balance = sc.nextDouble();

}
public void Deposit(){
int deposit=0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter amount you want to deposit: ");
deposit = sc.nextInt();
acc_balance += deposit;
}
public void Withdraw(){
int withdraw=0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter amount to be withdrawn:");
withdraw = sc.nextInt();
acc_balance -= withdraw;
}
public void BalaceInquiry(){
System.out.println("Your balance is: "+acc_balance);
}
}

class Main {
public static void main(String[] args){
BankAcc bankAcc1 = new BankAcc();
bankAcc1.CreateAcc();
bankAcc1.Deposit();
bankAcc1.Withdraw();
bankAcc1.BalaceInquiry();

BankAcc bankAcc2 = new BankAcc();
bankAcc2.CreateAcc();
bankAcc2.BalaceInquiry();
}

}

0 comments on commit 464e037

Please sign in to comment.