0% found this document useful (0 votes)
1 views9 pages

Bank Automation

The document is a Java program for a bank automation system that allows users to manage their bank accounts, including creating new accounts, depositing and withdrawing money, and viewing transaction details. It features a main menu for user interactions and handles account management through various methods. The program also includes input validation and transaction history tracking for each account.

Uploaded by

souryagd2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views9 pages

Bank Automation

The document is a Java program for a bank automation system that allows users to manage their bank accounts, including creating new accounts, depositing and withdrawing money, and viewing transaction details. It features a main menu for user interactions and handles account management through various methods. The program also includes input validation and transaction history tracking for each account.

Uploaded by

souryagd2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 9

import java.util.

*;
class bankautomation
{
String acno[];
String name[];
String add[];
int bal[];
int p;
int x;
String acs[];
String Status[];
String trancat[];
int amo[];

public bankautomation()
{
acno=new String[100];
name=new String[100];
add=new String[100];
bal=new int[100];
acs=new String[100];
trancat=new String[100];
p=1;
x=1;
Status=new String[100];
amo=new int[100];
acno[0]="10000001";
add[0]="Amtala";
name[0]="SAMIR DAS";
bal[0]=20000;
acs[0]="10000001";
Status[0]="BY CASH DEPOSIT SELF FOR OPEN ACCOUNT";
trancat[0]= "CR";
amo[0]=20000;
}

public void mainpage()


{
Scanner sc=new Scanner(System.in);

System.out.println("===============================================================
===============================================");
System.out.println("||
||");
System.out.println("|| BANK AUTOMATION
SYSTEM ||");
System.out.println("||
||");
System.out.println("|| ROTARY BANK OF INDIA (INDIA
GOVT. APPROVED) ||");
System.out.println("|| RESERVE BANK OF
INDIA ||");
System.out.println("|| UNDER TAKEN
||");
System.out.println("||
||");

System.out.println("===============================================================
===============================================");
System.out.println("===============================================================
===============================================");
System.out.println("| MAIN MENU
|");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("| 1. MY ACCOUNT
|");
System.out.println("| 2. CREATE NEW ACCOUNT
|");
System.out.println("| 3. LAST TRANSACTION DETAILS
|");
System.out.println("| 4. EXIT
|");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.print("| ENTER YOUR CHOICE : ");
int ch=sc.nextInt();
switch(ch)
{
case 1:
myacc();
break;
case 2:
createac();
break;
case 3:
tran();
break;
case 4:

System.out.println("===============================================================
===============================================");

System.out.println("===============================================================
===============================================");
System.out.println("|| THANKING YOU TO BANKING
WITH US ........ VISIT AGAIN ||");

System.out.println("===============================================================
===============================================");

System.out.println("===============================================================
===============================================");
break;
default:
System.out.println("Your Choice not match with Menu Item... Please
Try again !!!!!!");
mainpage();
break;
}

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
}
public void myacc()
{
Scanner sc1=new Scanner(System.in);

System.out.println("===============================================================
===============================================");
System.out.println("| WELCOME TO MY ACCOUNT
THANKING FOR STAY WITH US |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("| 1. MY ACCOUNT DETAILS
|");
System.out.println("| 2. DEPOSITE AMOUNT
|");
System.out.println("| 3. WITHDRAWAL
|");
System.out.println("| 4. SHOW THE BALANCE
|");
System.out.println("| 5. GO TO MAIN MENU
|");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.print("| ENTER YOUR CHOICE : ");
int ch1=sc1.nextInt();
switch(ch1)
{
case 1:
showd();
break;
case 2:
depo();
break;
case 3:
with();
break;
case 4:
showd();
break;
case 5:
mainpage();
break;
default:
System.out.println("Your Choice not match with Menu Item... Please
Try again !!!!!!");
myacc();
break;
}

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
}

public void createac()


{
Scanner sc2=new Scanner(System.in);
Scanner sc3=new Scanner(System.in);
System.out.println("===============================================================
===============================================");
System.out.println("| CREATE A NEW
ACCOUNT |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("PLEASE ENTER YOUR FULL NAME (IN CAPITAL)");
String n=sc2.nextLine();
name[p]=n.toUpperCase();
System.out.println("PLEASE ENTER YOUR ADDRESS (IN CAPITAL)");
String a=sc2.nextLine();
add[p]=a.toUpperCase();
int max = 10;
int min = 1;
int range = max - min + 1;
int rand=0;

for (int i = 0; i < 10; i++)


{
rand = (int)(Math.random() * range) + min;
}
int rac=Integer.parseInt(acno[p-1]);
rac=rac+rand;
acno[p]=String.valueOf(rac);
acs[x]=String.valueOf(rac);

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("| YOUR ACCOUNT SUCCESSFULLY
CREATED |");
System.out.println("| WELCOME MR./MRS. "+name[p]+" YOUR NEW BANK ACCOUNT NO
IS "+acno[p]);

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
while(true)
{
System.out.println("PLEASE ENTER YOUR AMOUNT FOR START YOUR BANK
ACCOUNT");
int am=sc3.nextInt();
if(am==0)
{
System.out.println("PLEASE ENTER VALID AMOUNT");
}
else
{
bal[p]=am;
Status[x]="BY CASH DEPOSIT SELF FOR OPEN ACCOUNT ";
trancat[x]="CR";
amo[x]=am;
break;
}
}
p++;
x++;

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("| YOUR ACCOUNT CREATE SUCCESSFULLY
THAKNING YOU TO BANKING WITH US |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
myacc();
}

public void showd()


{
Scanner sc4=new Scanner(System.in);

System.out.println("===============================================================
===============================================");
System.out.println("| SHOW YOUR
DETALS |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("PLEASE ENTER YOUR 8 DIGIT ACCOUNT NUMBER");
String ac=sc4.nextLine();
int f=-1;
if(ac.length()<8)
{
System.out.println("PLEASE ENTER CURRECT YOUR 8 DIGIT ACCOUNT NUMBER");
}
else
{
for(int i=0;i<p;i++)
{
if(acno[i].compareTo(ac)==0)
{
f=i;
break;
}
}

if(f>-1)
{

System.out.println("===============================================================
===============================================");
System.out.println("| YOUR
DETALS |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("| MR./MRS. "+name[f]);
System.out.println("| BANK ACCOUNT NO IS : "+acno[f]);
System.out.println("| YOUR ADDRESS : "+add[f]);

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("| YOUR LAST BALANCE : "+bal[f]);

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
}
else
{
System.out.println("YOUR ACCOUNT NOT FOUND");
}
}

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
myacc();
}
public void depo()
{
Scanner sc5=new Scanner(System.in);

System.out.println("===============================================================
===============================================");
System.out.println("| DEPOSIT YOUR
AMOUNT IN YOUR ACCOUNT |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("PLEASE ENTER YOUR 8 DIGIT ACCOUNT NUMBER");
String ac=sc5.nextLine();
int f=-1;
for(int i=0;i<p;i++)
{
if(acno[i].compareTo(ac)==0)
{
f=i;
break;
}
}

if(f>-1)
{
System.out.println("PLEASE ENTER YOUR AMOUNT FOR DEPOSIT");
int am=sc5.nextInt();
if(am==0)
{
System.out.println("THIS IS NOT VALID AMOUNT");
}
else
{
acs[x]=ac;
Status[x]="CASH DEPOSIT BY SELF ";
trancat[x]="CR";
amo[x]=am;
bal[f]=bal[f]+am;
System.out.println("YOURS AMOUNT RS. "+am+" IS DEPOSITED TO YOUR
BANK ACCOUNT");
System.out.println("YOURS LAST BALANCE IS RS. "+bal[f]);
x++;
}
}
else
{
System.out.println("YOUR ACCOUNT NOT FOUND");
}

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
myacc();
}

public void with()


{
Scanner sc6=new Scanner(System.in);

System.out.println("===============================================================
===============================================");
System.out.println("| WITHDRAWAL YOUR
AMOUNT FROM YOUR ACCOUNT |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("PLEASE ENTER YOUR 8 DIGIT ACCOUNT NUMBER");
String ac=sc6.nextLine();
int f=-1;
for(int i=0;i<p;i++)
{
if(acno[i].compareTo(ac)==0)
{
f=i;
break;
}
}

if(f>-1)
{
System.out.println("PLEASE ENTER YOUR AMOUNT FOR WITHDRAWAL");
int am=sc6.nextInt();
if(am==0)
{
System.out.println("THIS IS NOT VALID AMOUNT");
}
else
{
if(bal[f]<=am)
{
System.out.println("YOUR BALANCE NOT SUFFICIENT FOR
WITHDRAWAL");
}
else
{
acs[x]=ac;
Status[x]="CASH WITHDRAWAL BY SELF ";
trancat[x]="DR";
amo[x]=am;
bal[f]=bal[f]-am;
System.out.println("YOU WITHDRAW AMOUNT RS. "+am+" ");
System.out.println("YOURS LAST BALANCE IS RS. "+bal[f]);
x++;
}
}

}
else
{
System.out.println("YOUR ACCOUNT NOT FOUND");
}

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
myacc();
}

public void tran()


{
Scanner sc7=new Scanner(System.in);

System.out.println("===============================================================
===============================================");
System.out.println("| TRANSACTION
DETAILS OF YOUR ACCOUNT |");

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
System.out.println("PLEASE ENTER YOUR 8 DIGIT ACCOUNT NUMBER");
String ac=sc7.nextLine();
int f=-1;
for(int i=0;i<p;i++)
{
if(acno[i].compareTo(ac)==0)
{
f=i;
break;
}
}

if(f>-1)
{
System.out.println("ACCOUNT NUMBER : "+ acno[f]);
System.out.println("ACCOUNT HOLDER NAME : "+ name[f]);
System.out.println("DESCRIBTION \t\t\t\t AMOUNT TRANSACTION CATEGORY \
t BALANCE AMOUNT ");
int balp=0;

System.out.println("---------------------------------------------------------------
----------------------------------------");
for(int i=0;i<x;i++)
{
if(acs[i].compareTo(ac)==0)
{
if(trancat[i].compareTo("CR")==0)
{
balp=balp+amo[i];
}
else
{
balp=balp-amo[i];
}
System.out.println(Status[i]+" \t "+amo[i]+"\t"+ trancat[i]+" \
t\t\t"+balp);
}
}

System.out.println("---------------------------------------------------------------
----------------------------------------");
System.out.println("END OF THE DETAILS");

System.out.println("---------------------------------------------------------------
----------------------------------------");
System.out.println("YOUR BALANCE AMOUNT RS. : "+ bal[f]);

System.out.println("---------------------------------------------------------------
----------------------------------------");
}
else
{
System.out.println("YOUR ACCOUNT NOT FOUND");
}

System.out.println("---------------------------------------------------------------
-----------------------------------------------");
mainpage();
}

public static void main(String args[])


{
bankautomation obj=new bankautomation();
obj.mainpage();
}
}

You might also like