Question: open Customer -name: String -address: String -account: SavingAccount(1..5) +indexOfAccount: int +Customer(name: String, address: String) setAccount (acct: SavingAccount void + getAccount(index: int): SavingAccount +displayCustomerInfo():void SavingAccount accountid:




open Customer -name: String -address: String -account: SavingAccount(1..5) +indexOfAccount: int +Customer(name: String, address: String) setAccount (acct: SavingAccount void + getAccount(index: int): SavingAccount +displayCustomerInfo():void SavingAccount accountid: String -balance: double +SavingAccount (accountId: String, balance: double) +setAccoundId(accountId: String: void +getAccountId : String +set Balance balance: double): void +getBalance(): double +withdraw(amount: double): void +deposit(amount: double void +display AccountInfo(): vold 1 1..5 registered at 1 Bank customers: Customer [...] +Banko +addCustomer(cust: Customer): void +display Bankinfo(): void Figure 1: Bank Application 2. Base on Figure 1: a) Modify Customer class in Lab 4. Instance Variable / Conetructor/Method Description accounts An array of SavingAccount reference object. indexOfAccount Current index of accounts. Customer() Constructor that initialize name, address, create array that hold 5 reference object of SavingAccount, and initialize indexOfAccount to 0 setAccount() Method to set the accounts element at specific indexOfAccount and increase indexOfAccount by 1. The method will be invoked for everytime new accounts is created. getAccount() Method to get the accounts at a specific index. displayCustomerInfo() Method to display customer info and his account by invoking displayAccountInfo() in SavingAccount class. b) Define Bank class: Instance Variable / Conetructor/Method Description An ArrayList of Customer reference object. Bank) Constructor that create ArrayList of customers Customer. addCustomer displayBankInfo() Method to add customer to ArrayList of Customer. Method to display customer info and his account by invoking displayCustomerInfo() in Customer class. ) c) Define TestAccount class: i) Create an object for a customer named Siti from Batu Berendam. She open 3 account: SA001 with initial balance RM1000, SA002 with initial balance RM500.00, and SA003 with initial balance RM800. 11 Create another object for a customer named Jonathan from Ayer Keroh. He open 2 account: SA010 with initial balance RM700.00, and SA011 with initial balance RM1000 Add all customer to the ArrayList of Customer. iv) Display all the customer info and his account by invoking displayBankInfo(). Output example: Name: Siti Address: Batu Berendan Customer's account: Account id : SA001 Account id: SA002 Account id : SA003 Balance: RM180.00 Balance: RM500.00 Balance: RM800.00 Name: Jonathan Address: Ayer Keroh Customer's account: Account id: SA81@ Account id: SA811 Balance: RM700.ee Balance: RM1000.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
