import java.util.*;
import java.lang.*;
class Bank
{
String name;
float acc_no,balance;
void accept(String str, float no, float bal)
{
name=str;
acc_no=no;
balance=bal;
}
public String toString()
{
return(name+"\t"+acc_no+"\t"+balance);
}
}
class Withdraw
{
String date;
float acc_no,amount;
void accept(String str, float no, float amt)
{
date=str;
acc_no=no;
amount=amt;
}
}
class Deposit
{
String date;
float acc_no,amount;
void accept(String str, float no, float amt)
{
date=str;
acc_no=no;
amount=amt;
}
}
abstract class bankaccount
{
public static void main(String []args)
{
String str,str1;
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
Vector bank = new Vector();
Vector withdraw = new Vector();
Vector deposit = new Vector();
int i,choice=0,j=0,k=0,l;
float bal,no,amt;
Bank b[]=new Bank[1000];
Withdraw w[]=new Withdraw[1000];
Deposit d[]=new Deposit[1000];
System.out.println("Enter name, account number and balance of 3 account holders:");
for(i=0;i<=2;i++)
{
b[i]=new Bank();
str1=br.readLine();
no=Float.parseFloat(br.readLine());
bal=Float.parseFloat(br.readLine());
b[i].accept(str1,no,bal);
bank.addElement(b[i]);
}
while(choice!=5)
{
System.out.println("1.Add new customer\n2.Withdrawal \n3.Deposit\n4. View Contents\n5. Exit\nEnter your choice:");
choice=Integer.parseInt(br.readLine());
switch(choice)
{
case 1: System.out.println("Enter name, account number and balance:");
str1=br.readLine();
no=Float.parseFloat(br.readLine());
bal=Float.parseFloat(br.readLine());
b[i]=new Bank();
b[i].accept(str1,no,bal);
bank.addElement(b[i]);
i++;
break;
case 2: System.out.println("Enter account number, amount and date:");
no=Float.parseFloat(br.readLine());
amt=Float.parseFloat(br.readLine());
str1=br.readLine();
w[j]=new Withdraw();
w[j].accept(str1,no,amt);
withdraw.addElement(w[j]);
j++;
l=0;
while(b[l].acc_no!=no)
{
l++;
}
bank.removeElement(b[l]);
b[l].balance-=amt;
bank.addElement(b[l]);
break;
case 3: System.out.println("Enter account number, amount and date:");
no=Float.parseFloat(br.readLine());
amt=Float.parseFloat(br.readLine());
str1=br.readLine();
d[k]=new Deposit();
d[k].accept(str1,no,amt);
deposit.addElement(d[k]);
k++;
l=0;
while(b[l].acc_no!=no)
{
l++;
}
bank.removeElement(b[l]);
b[l].balance+=amt;
bank.addElement(b[l]);
break;
case 4: for(i=0;i<=bank.size()-1;i++)
{
System.out.println(bank.elementAt(i));
}
break;
case 5: break;
default: System.out.println("Invalid choice");
}
}
}
}