Bank{ public void modifyBusinessUnit() {{ /* This function will allow the user to modify business unit information */ BusinessUnit changeMe; //the unit that needs to be modified Index changeMeId; //index of the unit we will modify changeMeId = Index.prompt("Enter the index of the unit you wish to modify: "); changeMe = get_businessunit_list().findBusinessUnit(changeMeId, true); if (changeMe != null) changeMe.modify(); }} }//end Bank BusinessUnit{ {{ private static int QUIT = 6; }} public void modify(){{ /* modifies this business unit with user input */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in business unit: " + e.toString()); e.printStackTrace(); } } }} private void showMenu(){{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Business Unit menu:"); System.out.println("1. Update country"); System.out.println("2. Update location"); System.out.println("3. Add a party"); System.out.println("4. Work with a party"); System.out.println("5. View all parties"); System.out.println("6. Quit"); }} private void doMenuChoice(int choice) {{ /* executes the menu choice given by the user input: choice - choice given by the user */ if (choice == 1) updateCountry(); else if (choice == 2) updateLocation(); else if (choice == 3) addParty(); else if (choice == 4) modifyParty(); else if (choice == 5) viewParties(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateCountry(){{ set_country(Country.prompt("Enter the new country:")); }} private void updateLocation(){{ set_location(Location.prompt("Enter the new location:")); }} private void modifyParty() {{ /* This function will allow the user to modify customer information */ Party changeMe; //the party that needs to be modified PartyId changeMeId; //id of the party we will modify changeMeId = PartyId.prompt("id number: "); changeMe = Main.b.findParty(changeMeId, true); if (changeMe != null){ try { Individual dummy = (Individual) changeMe; dummy.modify(); } catch (ClassCastException e) { CorporateBody dummy = (CorporateBody) changeMe; dummy.modify(); } } }} }//end Business Unit Party{ protected void updateAgreement(){{ get_agreement().modify(); }} } Individual { {{ private static int QUIT = 5; }} public void modify(){{ /* This function will modify an individual */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in corporate body: " + e.toString()); e.printStackTrace(); } } }} private void showMenu() {{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Modify individual:"); System.out.println("1. Update first name"); System.out.println("2. Update last name"); System.out.println("3. Update birthdate"); System.out.println("4. Update agreement"); System.out.println("5. Quit"); }} private void doMenuChoice(int choice) {{ /* execute user chocie input: choice - choice entered by the user */ if (choice == 1) updateFirstName(); else if (choice == 2) updateLastName(); else if (choice == 3) updateBirthdate(); else if (choice == 4) updateAgreement(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateFirstName(){{ set_firstname(FirstName.prompt("Enter the new first name"));}} private void updateLastName(){{ set_lastname(LastName.prompt("Enter the new last name"));}} private void updateBirthdate(){{ set_birthdate(Date.prompt("Enter the new birthdate"));}} } //end Individual CorporateBody { {{ private static int QUIT = 4; }} public void modify(){{ /* This function will allow the user to modify any information about this corporate body */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in corporate body: " + e.toString()); e.printStackTrace(); } } }} private void showMenu(){{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Modify corporate body:"); System.out.println("1. Update company name"); System.out.println("2. Update company rating"); System.out.println("3. Update agreement"); System.out.println("4. Quit"); }} private void doMenuChoice(int choice) {{ if (choice == 1) updateName(); else if (choice == 2) updateRating(); else if (choice == 3) updateAgreement(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateName(){{ set_companyname(CompanyName.prompt("Enter new company name"));}} private void updateRating() {{ set_rating(Rating.prompt("Enter new rating")); }} } //end CorporateBody Agreement{ {{ private static int QUIT = 7; }} public void modify(){{ /* Modifies this agreement */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in agreement: " + e.toString()); e.printStackTrace(); } } }} private void showMenu(){{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Agreement menu:"); System.out.println("1. Add a contract"); System.out.println("2. Update a contract"); System.out.println("3. View all contracts"); System.out.println("4. Update a rule"); System.out.println("5. View all rules"); System.out.println("6. Update statement ending day"); System.out.println("7. Quit"); }} private void doMenuChoice(int choice) {{ /* executes the menu choice given by the user input: choice - choice given by the user */ if (choice == 1) addContract(); else if (choice == 2) updateContract(); else if (choice == 3) viewContracts(); //else if (choice == 4) updateRule(); //else if (choice == 5) viewRules(); else if (choice == 6) updateStatementDay(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateContract(){{ /* asks the user for a contract to change and changes it */ Index changeMeIndex = Index.prompt("Enter the index number of the contract you wish to change"); Contract changeMe = get_contract_list().findContract(changeMeIndex, true); if (changeMe != null) changeMe.modify(); }} private void updateStatementDay(){{set_statement_ending(Day.prompt("Enter the new statement ending day:"));}} }//end Agreement Contract { {{ private static int QUIT = 5; }} public void modify(){{ /* modifies this contract with user input */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in contract: " + e.toString()); e.printStackTrace(); } } }} private void showMenu(){{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Contract menu:"); System.out.println("1. Update location"); System.out.println("2. Add a portfolio"); System.out.println("3. Work with a portfolio"); System.out.println("4. View all portfolios"); System.out.println("5. Quit"); }} private void doMenuChoice(int choice) {{ /* executes the menu choice given by the user input: choice - choice given by the user */ if (choice == 1) updateLocation(); else if (choice == 2) addPortfolio(); else if (choice == 3) updatePortfolio(); else if (choice == 4) viewPortfolios(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateLocation(){{ set_location(Location.prompt("Enter the new location"));}} private void updatePortfolio(){{ /* asks the user for a portfolio to change and changes it */ Index changeMeIndex = Index.prompt("Enter the index number of the portfolio you wish to change"); Portfolio changeMe = get_portfolios().findPortfolio(changeMeIndex, true); if (changeMe != null) changeMe.modify(); }} }//end Contract Portfolio { {{ private static int QUIT = 5; }} public void modify(){{ /* modifies this portfolio with user input */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in portfolio: " + e.toString()); e.printStackTrace(); } } }} private void showMenu(){{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Portfolio menu:"); System.out.println("1. Update description"); System.out.println("2. Add an account"); System.out.println("3. Work with an account"); System.out.println("4. View all accounts"); System.out.println("5. Quit"); }} private void doMenuChoice(int choice) {{ /* executes the menu choice given by the user input: choice - choice given by the user */ if (choice == 1) updateDescription(); else if (choice == 2) addAccount(); else if (choice == 3) updateAccount(); else if (choice == 4) viewAccounts(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateAccount() {{ /* asks the user for a account to change and changes it */ AccountID changeMeID = AccountID.prompt("Enter the account id:"); Account changeMe = get_accounts().findAccount(changeMeID, true); if (changeMe != null) changeMe.modify(); }} private void updateDescription(){{ set_description(Description.prompt("Enter the new description"));}} }//end Portfolio Account{ {{ private static int QUIT = 4; }} public void modify(){{ /* modifies this account with user input */ int choice = 0; while (choice != QUIT){ try{ showMenu(); choice = Main.getChoice(); doMenuChoice(choice); } catch(Exception e){ System.out.println("Error in account: " + e.toString()); e.printStackTrace(); } } }} private void showMenu(){{ /* This function just displays a menu */ System.out.println(Main.divider); System.out.println("Account menu:"); System.out.println("1. Add a posting"); System.out.println("2. View all postings"); System.out.println("3. Update account type"); System.out.println("4. Quit"); }} private void doMenuChoice(int choice) {{ /* executes the menu choice given by the user input: choice - choice given by the user */ if (choice == 1) addPosting(); else if (choice == 2) viewPostings(); else if (choice == 3) updateAccountType(); else if (choice != QUIT) System.out.println("Invalid choice"); }} private void updateAccountType(){{ set_accounttype(AccountType.prompt("Enter the new account type"));}} }//end Account