// BankClient.java import java.lang.*; import BankApp.*; import org.omg.CosNaming.*; import org.omg.CORBA.*; public class BankClient { public static void main(String args[]) { try{ // create and initialize the ORB org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null); // get the root naming context org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContext ncRef = NamingContextHelper.narrow(objRef); // resolve the Object Reference in Naming NameComponent nc = new NameComponent("BankManager", ""); NameComponent path[] = {nc}; BankApp.AccountManager manager = BankApp.AccountManagerHelper.narrow(ncRef.resolve(path)); System.out.println("Successfully bound to AccountManager object : \n" + manager + "\n"); String name = "John"; float balance = 10000; if ((args[0].charAt(0) != '-') && (args[1].charAt(0) != '-')) { name = args[0]; String sbalance = args[1]; balance = new Float(sbalance).floatValue(); } BankApp.Account account = manager.open(name, balance); System.out.println ("\nThe balance in " + account.name() + "'s account is : $" + account.balance()); } catch (Exception e) { System.out.println("ERROR : " + e) ; e.printStackTrace(System.out); } } }