Question: I V. Opening and Closing Accounts File Account. java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw,

I V. Opening and Closing Accounts File Account. java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a String representation. Note that the constructor for this dass creates a random account number. Save this dass to your directory and study it to see how it works. Then write the following additional code: 1. Suppose the bank wants to keep track of how many accounts exist. a Dedare a private static integer variable numAccounts to hold this value. Like all instance and static variables, it will be initialized (to 0, since it's an int) automatically. b. Add code to the constructor to increment this variable every time an account is created. C. Add a static method getNumAccounts that returns the total number of accounts. Think about why this method should be static - its information is not related to any particular account
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
