Bank { public void addBusinessUnit(){{ /* This function will add a new business unit to the bank.*/ Index index; //the index of the new unit Country country; //the country of the new unit Location location; //the location of the new unit BusinessUnit newBU; //the unit created that will be added to the bank try { location = Location.prompt("Enter location of new unit"); country = Country.prompt("Enter country of new unit"); //generate index if (get_businessunit_list() == null) index = new Index(1); else index = new Index(get_businessunit_list().size() + 1); //add the new business unit newBU = new BusinessUnit(index, country, location, new Party_List()); businessunit_list.addElement(newBU); //inform the user that add was successful System.out.println("Business unit "); newBU.viewUnit(); System.out.println("has been added"); } catch (Exception e) { System.out.print ("Error in addBusinessUnit: " + e.toString());} }} } //end Bank BusinessUnit{ public void addParty() {{ /* This function will add a new party to this business unit. */ Party lookForParty; //used to verify this is a new customer to this bank Party newParty = Party.promptParty("", true); //continue if the party is valid if (newParty != null){ //see if the party already exists in the bank lookForParty = Main.b.findParty(newParty.get_partyid(), true); if (lookForParty == null){ get_party_list().addElement(newParty); //inform the user that add was successful System.out.println("Party "); newParty.viewParty(); System.out.println("has been added"); } else System.out.println("Customer already exists with that id"); }//end if valid party }} }//end BusinessUnit Agreement { private void addContract(){{ /* adds a new contract to this agreement */ Location newLocation; //location of this contract Index index; //index of the contract will be generated Contract newContract; try{ newLocation = Location.prompt("Enter contract location:"); //generate index if (get_contract_list() == null) index = new Index(1); else index = new Index(get_contract_list().size() + 1); //add the contract newContract = new Contract(index, newLocation, new Portfolio_List()); contract_list.addElement(newContract); //inform the user that add was successful System.out.println("Contract "); newContract.viewContract(); System.out.println("has been added"); } catch (Exception e){System.out.println("Error in addContract: " + e.toString());} }} }//end Agreement Contract{ private void addPortfolio() {{ /* adds a new portfolio to this contract */ Index index; //index of the new portfolio Portfolio addMe; //the portfolio we will create and add //get description for new portfolio Description newDescription = Description.prompt("Enter a description of this portfolio"); //generate index of new portfolio if (get_portfolios() == null) index = new Index(1); else index = new Index(get_portfolios().size() +1); addMe = new Portfolio(index, newDescription, new Account_List()); get_portfolios().addElement(addMe); //inform the user that add was successful System.out.println("Portfolio "); addMe.viewPortfolio(); System.out.println("has been added"); }} }//end Contract Portfolio{ private void addAccount() {{ /* adds a new account to this portfolio */ AccountID accountId; //id of the new account Account addMe; //the account we will create and add AccountType type = AccountType.prompt("Enter the type of this new account"); //generate id of new account //FOR LATER: ACCOUNT ID SHOULD BE RANDOMLY GENERATED AND ALL ACCOUNTIDS // SHOULD BE UNIQUE if (get_accounts() == null) accountId = new AccountID(1); else accountId = new AccountID(get_accounts().size() +1); addMe = new Account(new Posting_List(), accountId, type, null); get_accounts().addElement(addMe); //need to add the agreement //inform the user that add was successful System.out.println("Account "); addMe.viewAccount(); System.out.println("has been added"); }} }//end Portfolio Account{ private void addPosting() {{ /* adds a new posting to this portfolio */ Posting newPosting = Posting.prompt(""); get_postings().addElement(newPosting); //inform the user that add was successful System.out.println("Posting "); newPosting.viewPosting(); System.out.println("has been added"); }} }//end Account