MCPcopy Create free account
hub / github.com/Mahavishnu-06/BankingSystem / main

Method main

Main.java:5–118  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

3import java.util.Scanner;
4public class Main {
5 public static void main(String[] args) {
6 Scanner sc=new Scanner(System.in);
7 bankService bank=new bankService();
8 BankAccout currentuser=null;
9 while(true){
10 if(currentuser==null){
11 System.out.println("\n--- BANK MENU ---");
12 System.out.println("1. Create Account");
13 System.out.println("2. Login");
14 System.out.println("3. Exit");
15 System.out.print("Enter choice: ");
16 int choice =sc.nextInt();
17 try{
18 switch(choice){
19 case 1:{
20 System.out.println("Enter Account Number: ");
21 int accno=sc.nextInt();
22 sc.nextLine();
23 System.out.println("Enter Name: ");
24 String name=sc.next();
25 System.out.println("Enter Account Type (Savings/Current): ");
26 String type = sc.next();
27 System.out.println("Enter PIN: ");
28 int pin = sc.nextInt();
29 bank.AccountCreation(accno, name, type, pin);
30 System.out.println("Account created successfully!");
31 break;
32 }
33 case 2:{
34 System.out.println("Enter Account Number: ");
35 int loginAcc = sc.nextInt();
36 System.out.println("Enter PIN: ");
37 int loginPin = sc.nextInt();
38 currentuser = bank.Login(loginAcc, loginPin);
39 System.out.println("Login successful. Welcome " + currentuser.getName());
40 break;
41 }
42 case 3:{
43 System.out.println("Thank you for using the Banking System.");
44 return;
45 }
46
47 default:
48 System.out.println("Invalid choice");
49 }
50 }catch(Exception e){
51 System.out.println(e.getMessage());
52 }
53 }
54 else{
55 System.out.println("\n--- ACCOUNT MENU ---");
56 System.out.println("1. Deposit");
57 System.out.println("2. Withdraw");
58 System.out.println("3. Transfer");
59 System.out.println("4. Check Balance");
60 System.out.println("5. Transaction History");
61 System.out.println("6. Logout");
62 System.out.print("Enter choice: ");

Callers

nothing calls this directly

Calls 9

AccountCreationMethod · 0.95
LoginMethod · 0.95
getNameMethod · 0.95
depositMethod · 0.95
withdrawMethod · 0.95
transfrerMethod · 0.95
getAccountnoMethod · 0.95
getBalanceMethod · 0.95
getTransactionhistoryMethod · 0.95

Tested by

no test coverage detected