Question: solve please with steps 1. Write the class Account which includes: a) 3 attributes: account number (which is unique), holder name, and balance. b) a
1. Write the class Account which includes: a) 3 attributes: account number (which is unique), holder name, and balance. b) a zero-arg constructor and a mutli-arg constructor. c) getter and setter for balance attribute. d) toString() method which overrides the Object's toString() method. e) equals() method which overrides the object's equals() method. 2. Write the class Bank which includes: (add the necessary import statements) a) 2 attributes: bank name and ArrayList of Accounts. b) one-arg constructor that accepts (as an argument) the bank name, and create a new empty Arraylist of Accounts. c) method createAccount() that accepts an Account and add it to the Arraylist with a confirmation message. It is not allowed to add the same Account twice and in this case an error message should be displayed. d) method averageBalance() which returns the average balance of all accounts in the Bank. e) method savelntofile() which accepts a file name. It stores the bank name and information of all Accounts in this file (each Account in a different line). 3. Write a code to test your classes by performing the following tasks: a) create a Bank object called myBank where the bank name is "ABCDE". b) create 2 Accounts and add them to myBank using the method createAccount() c) print the average balance of all accounts in the Bank by calling the method averageBalance () d) call the method saveintofile() to save the required information
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
