Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions