Implement an Account class which tracks deposit and withdrawal transactions. Pro
ID: 3680590 • Letter: I
Question
Implement an Account class which tracks deposit and withdrawal transactions. Provide a method to deposit a value, and be sure to process the deposit for positive values only. Provide a method to withdraw a value, and be sure to do so only if there is sufficient funds. Each time a transaction is made, you must store the value, and the running balance. Use a 2D array to do so and provide an accessor method which returns the array. However, make sure the accessor method only returns transactions (empty arrays elements should be expunged). Also provide a method which returns the most recent balance. An Account constructor should set a default size for the transactions array, but you should provide a private method which increases its size automatically whenever necessary. Store deposits as positive values and withdrawals as negative values and use a private method to automatically calculate the running balance after each transaction, finally, provide a count () method which returns the total number of transactions and another count() method which returns the number of withdrawals over a value provided to the method (eg. all withdrawals over $10000). To demonstrate the functionality of Account, create an Account Driver which does the following. You will be evaluated on the efficiency of your display commands in your driver, so consider using print f() to format it appropriately in combination with one of more loops.Explanation / Answer
Please find the required program below:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.