Note: (Restricted functionality due to obvious reasons!)
Minimal Code ( Raw-View ) :
import java.rmi.*;
import java.io.*;
class CProg
{
public static void main(String zee[]) throws Exception
{
IProg obj = (IProg)Naming.lookup("obj");
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
int readkb=0, response, amt;
do
{
if(readkb == 1)
{
System.out.println("\tBalance = "+obj.bal());
}
if(readkb == 2)
{
System.out.print(" Enter amount : ");
amt = Integer.parseInt(br.readLine());
response = obj.deposit(amt);
if( response == 1000)
{
System.out.println("\t"+amt+" Deposited Successfully ! ");
}
else
{
System.out.println("\t Deposition UnSuccessful ! ");
}
}
if(readkb == 3)
{
System.out.print(" Enter Withdrawal Amount : ");
amt = Integer.parseInt(br.readLine());
response = obj.withdraw(amt);
if( response == 1000)
{
System.out.println("\t"+amt+" Withdrawn ! ");
}
else if(response == 5001)
{
System.out.println("\t Invalid Amount !");
}
else if(response == 5010)
{
System.out.println("\t Insufficient Balance ! ");
}
else
{
System.out.println("\t Unable to Withdraw ! ");
}
}
if(readkb == 4)
{
obj.exit("Cancelled by User !");
System.out.println("Bal = "+obj.bal());
}
System.out.println("\nChoose : \n 1: Balance \t 2: Deposit \t 3: Withdraw\t 4: Exit ");
try
{
readkb = Integer.parseInt(br.readLine());
}
catch(Exception e)
{
readkb = 4;
System.out.println("Invalid choice");
}
}
while(readkb!=4);
}
}