Answered step by step
Verified Expert Solution
Question
1 Approved Answer
BackAccount add-ons: Using your project #1, please add the following add-ons. 1) Create a Private Static instance variable (numAccounts), which keeps track of how many
BackAccount add-ons: Using your project #1, please add the following add-ons. 1) Create a Private Static instance variable (numAccounts), which keeps track of how many savings accounts created in the system. - The idea is each time you instantiate a "New" BankAccount, this static variable increases to reflect that. - Of course we will need an accessor method (getNumAccounts) to retrieve this value. Don't need a mutator method, since this will be initialized to zero at startup. 2) Add some range checking for some of the previous instance variables: - for name, just trim the string to remove blanks before/after string, id (00001 - 99999), setting balance (10,000 dep limit) and withdrawal (2000 withdr limit) amount - for any out of range values, your program should output an error message to the screen and NOT count it as a transaction. 3) Add a NEW class instance variable - an integer array to hold the last 5 transactions. - Basically when a valid Deposit or Withdrawal amount is specified, you store it in the array. You only need to store the values (pos for deposits and negative for withdrawal). - Add one method (getRecentTransactions)to the class which will output the last 5 transactions. - for example, if for a particular savings account, the transactions are: savings1.deposit(10.00); savings1.deposit(50.00); savings1.withdraw(100.00); - then getRecentTransactions() will output the last 5 transactions: 10, 50, -100 - array elements get filled beginning at element 0...to 4. Since the array is of size 5, there may be a scenerio where there are more than 5 transactions. You decide how to handle this case, but please document how you will handle it. some choices are: store only the first 5 and ignore any remaining; or wrap-around and begin to overwrite the array. - note that you will need another private instance variable, which will used for the next available index to use in the array (since the array.length gives you the max size) but you will also need to know which is the next element to be filled. We had a lab on arrays which showed how to do this. As always, please perform tests of the above add-ons, showing these new added features, taking screenshots and storing all in one work-document. Please DO NOT submit ZIP files, only submit 3 files: the java class, the java demo class and the word document with screenshots.
pls answer this as soon as possible.
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