Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 7

import java.io.

* ;
class atm
{
public void display() throws IOException
{
BufferedReader r = new BufferedReader(new
InputStreamReader(System.in));
System.out.println ("WELCOME TO EAST WEST BANK OF WORLD ");
BufferedReader r1 = new BufferedReader(new
InputStreamReader(System.in));
String a[]= new String[100];
int ac[]=new int[100];
int Bal[]=new int[100];

for (int k=0;k<100;k++)


{System.out.println("Enter your name:");
a[k]=r.readLine();
System.out.println("Enter account no");
ac[k]=Integer.parseInt(r1.readLine());
System.out.println("enter minimum balance");
Bal[k]=Integer.parseInt(r1.readLine());
System.out.println("want to cont...: Y / N ");
String x1=r.readLine();
if(x1.equalsIgnoreCase("n"))
{
break;
}
}
//int x=372;
int i=0,amt=0;
for( i=0;i<100;i++)
{
System.out.println("The permanent members are :- ");
for(int j=0;j<100;j++)
{
if(ac[j]!=0)
System.out.println(a[j]+ "has ac no ."+ac[j]);
}

System.out.println("You are a permanent member : Y / N ");


String x1=r.readLine();
if(x1.equalsIgnoreCase("y"))
{
System.out.println("Please enter your accont no.");
int b = Integer.parseInt(r1.readLine());
int pos=-1;
for(int j=0;j<=49;j++)
{
if(ac[j]==b)
{
pos=j;
break;
}
}

if(pos!=-1)
{
System.out.println("Your balance is :" + Bal[pos]+ "\nYou can deposit
or Withdrawal money : Press 1 for Deposit money and Press 2 for
Withdrawal money ");

if(c==1)
{
System.out.println("Please enter the amt you want to deposit ");
amt=Integer.parseInt(r.readLine());
Bal[pos]=Bal[pos]+amt;
}
else if (c==2)
{
System.out.println("Please enter the amt you want to withdrawal");
amt=Integer.parseInt(r1.readLine());
if((Bal[pos]-amt)>1000)
{
Bal[pos]=Bal[pos]-amt;
System.out.println(Bal[pos]);
}
else

System.out.println("Warning ! Your balance is "+Bal[pos]+ "and so


you cannot withdrawal" +amt+ "as the balance become"+(Bal[pos]-amt)+
"Which is less than Rs.1000 the minimum balance to be kept in this
accont ");
}
else
{
System.out.println("You have made wrong entry !!!!!");
System.out.println("Thanking you , Have a good day.");
}
if(x1.equalsIgnoreCase("N"))
{
System.out.println("enter new account no");
b=Integer.parseInt(r.readLine());
System.out.println("enter intial balance amount");
amt=Integer.parseInt(r.readLine());
Bal[i]=amt;
}
System.out.println("Now do you want to Withdraw or Deposit money Y or
N ");
String xx=r.readLine();
if(xx.equalsIgnoreCase("Y"))
{
System.out.println ("Press 1 to Deposit and 2 for Withdraw Money ");
int xxx=Integer.parseInt(r1.readLine());
System.out.println("Enter your Ac no ");
c = Integer.parseInt(r1.readLine());
pos=-1;
for(int j=50;j<100;j++)
{
if(ac[j]==c)
{
pos=j;
break;
}
}
if(pos>-1)
{
if(xxx==1)
{
System.out.println ("Enter the amount you want to deposit ");
amt=Integer.parseInt(r1.readLine());
Bal[pos]=Bal[pos]+amt+i;
}
else if(xxx==2)
{
System.out.println("Enter the amt you want to Withdraw");
int amt1=Integer.parseInt(r1.readLine());
if((Bal[pos]-amt1)>1000)
{
Bal[pos]=Bal[pos]-amt;
System.out.println(Bal[pos]);
}
else
{
System.out.println("Warning !!!!!");
System.out.println(Bal[pos]);
}
}
else
{
System.out.println("Wrong entry ");
}
}
System.out.println("Thanking you ");
}
else
{
System.out.println(Bal[pos]);
System.out.println("Thank you , Have a nice day ");
break;
}
}
}}}}

/* input-output
* enter your name:-
* ankita chowdhury

* You a permanent member : Y / N


y
Please enter your accont no.
123456789
Your balance is :10000You can deposit or Withdrawal money : Press 1
for Deposit money and Press 2 for Withdrawal money
1
Please enter the amt you want to deposit
50000
Now do you want to Withdraw or Deposit money Y or N
n
your balance is 15000
Thank you , Have a nice day

*/

You might also like