Question
This needs to be in Java: Bank Class- addAccount() Bank Class data members: -->private BankAccount[ ] accounts; -->private int numAccounts = 0; --> private int
This needs to be in Java:
Bank Class- addAccount()
Bank Class data members:
-->private BankAccount[ ] accounts;
-->private int numAccounts = 0;
--> private int sizeBank =100;
Method addAccount( ):
IF numAccount >= sizeBank
PUT error message- no room
RETURN
PUT message to user to enter type of account - c or s (where c = chequing and s = savings)
GET type
IF accType == 's'
account[numAccounts] = new SavingsAccount( );
ELSE accounts[numAccounts] = new ChequingAccount( );
IF(accounts[numAcccounts].addBankAccount())
//account added successfully
numAccounts++
ELSE PUT account not added
Class Bank . This class will contain the array of BankAccount objects (which are instantiated with either SavingAccount or ChequingAccount objects); You will need to keep two ints as well -a maxSize and numAccounts Methods o constructor )-allocates default size of 1000 o constructor (int) parameter is size of array to be allocated o addAccount:boolean success add or not; prompts user to enter data for an account which is added to arrayeither chequing or savings account is added if there is room displayAccount() - String prompts user to enter an account number to display, then returns data formatted to display or an error message should use toString() from BankAccount class This o printAccountDetails()- prints details of all accounts o updateAccount) prompts user to enter which account number to update, and by how much and then updates the balance appropriately returns success message or error message o findAccount) intprompts user to enter which account number they wish to find and re turns array index of where it is found otherwise returns -1 monthlyUpdate() process through each current account in the array and updates the balance appropriately Class Bank . This class will contain the array of BankAccount objects (which are instantiated with either SavingAccount or ChequingAccount objects); You will need to keep two ints as well -a maxSize and numAccounts Methods o constructor )-allocates default size of 1000 o constructor (int) parameter is size of array to be allocated o addAccount:boolean success add or not; prompts user to enter data for an account which is added to arrayeither chequing or savings account is added if there is room displayAccount() - String prompts user to enter an account number to display, then returns data formatted to display or an error message should use toString() from BankAccount class This o printAccountDetails()- prints details of all accounts o updateAccount) prompts user to enter which account number to update, and by how much and then updates the balance appropriately returns success message or error message o findAccount) intprompts user to enter which account number they wish to find and re turns array index of where it is found otherwise returns -1 monthlyUpdate() process through each current account in the array and updates the balance appropriately
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started