Assigned date: 3/20 Due Date: 4/3 Concepts: Classes and objects, relationships b
ID: 3740411 • Letter: A
Question
Assigned date: 3/20 Due Date: 4/3 Concepts: Classes and objects, relationships between objects, array of objects Point value: 100 points Note: Use the Java Class, Account.java, provided. Please do not rename or make any changes to this class. Do not turn in the Account class. Your program will be tested with my own copy of the Account class provided (which is the same as yours) 1. Write a Java class, XXXX_Bank, where XXXX where XXXX is your Kean email id. (5 points) 2. At the beginning of the program, include a comment with your name and a brief description of the program. Please include a short comment before each method (5 points) 3. The Bank class will have the following instance variables: 5 points) a. An Array of Account objects that can hold 20 Accounts named, accounts b. An int variable, numberOfAccounts which indicates the number of Account objects in the account array 2. The Bank class will have the following constructor: a. A default/noargs constructor: (5 points) i. It will create the Array of Account objects ii. Set the numberOfAccounts to zero b. One accessor method: (5 points) public int getNumberOfAccountsO //returns the numberOfAccounts C. The following methods public void addAccount (Account a) (5 points) .Adds Account a to the Array of accounts Adds 1 to the numberOfAccounts public void addAccount(double initBalance) (5 points) Creates a new Account using initBalance Adds the new Account to the Array of accounts Adds 1 to the numberOfAccountsExplanation / Answer
Please find the solution below. Proper comments are provided before the class as well as each Instance variable and Instance method's definition. Program execution is also added at the end.
JAVA CLASS DEFINITIONS :
===================
Accounts.Java
===========
================
===================
OUTPUT :
=======
Enter balance
100
Enter balance
200
Enter balance
300
Enter balance
400
Enter balance
500
The accounts in the Bank are:
Account ID: 1 Balance: 100.0 Date Created: Fri Mar 30 22:04:02 IST 2018
Account ID: 2 Balance: 200.0 Date Created: Fri Mar 30 22:04:04 IST 2018
Account ID: 3 Balance: 300.0 Date Created: Fri Mar 30 22:04:06 IST 2018
Account ID: 4 Balance: 400.0 Date Created: Fri Mar 30 22:04:07 IST 2018
Account ID: 5 Balance: 500.0 Date Created: Fri Mar 30 22:04:09 IST 2018
The total balance in the bank is 1500.0
The account with height balance in the bank is
Account ID: 5 Balance: 500.0 Date Created: Fri Mar 30 22:04:09 IST 2018