import java.io.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import javax.naming.InitialContext;
import Bank.*;
public class BankClient
{
public static void main(String args[])
{
BankHome home;
BufferedReader br;
try
{
Context initial = new InitialContext();
Object objref = initial.lookup("MyBanking");
home = (BankHome)PortableRemoteObject.narrow(objref,TempHome.class);
Banking display = home.create();
try
{
br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter User Name-- > ");
String s = br.readLine();
System.out.println("Enter Account Number-- > ");
int acc = Integer.parseInt(br.readLine());
System.out.println("Enter Initial Amount-- > ");
int amt = Integer.parseInt(br.readLine());
System.out.println("1.Withdraw\n2.Deposit\n3.Balance\n");
System.out.println("Enter ur Choice-- > ");
int ch = Integer.parseInt(br.readLine());
switch(ch)
{
case 1:
System.out.println("Enter Withdraw Amount-- > ");
int wd = Integer.parseInt(br.readLine());
System.out.println("User Name-- > "+s);
System.out.println("Account Number-- > "+acc);
if(wd > amt)
System.out.println("Balance Less Unable to Process Transaction......");
else
System.out.println("Balance-- > "+display.withdraw(wd,amt));
break;
case 2:
System.out.println("Enter Deposit-- > ");
int dp = Integer.parseInt(br.readLine());
System.out.println("User Name-- > "+s);
System.out.println("Account Number-- > "+acc);
System.out.println("Balance-- > "+display.deposit(dp,amt));
break;
case 3:
System.out.println("User Name-- > "+s);
System.out.println("Account Number-- > "+acc);
System.out.println("Balance-- > "+display.balance(amt));
break;
}
}
catch(Exception e)
{
System.out.println("Thank U");
}
display.remove();
}
catch(Exception ex)
{
System.err.println("Caught an Exception");
ex.printStackTrace();
}
}
}
google Ads
Thursday, February 4, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment