MinMaxAccount. A company has written a large class BankAccount with many methods including:
public BankAccount(Startup s) | Constructs a BankAccount object using information in s |
public void debit(Debit d) | Records the given debit |
public void credit(Credit c) | Records the given credit |
public int getBalance ( ) | Returns the current balance in pennies |
Design a new class MinMaxAccount whose instances can be used in place of a bank account but include new behavior of remembering the minimum and maximum balances ever recorded for the account. The class should have a constructor that accepts a Startup parameter. The bank account’s constructor sets the initial balance on the basis of the startup information. Assume that only debits and credits change an account’s balance. Include these new methods in your class:
public int getMin ( ) | Returns the minimum balance in pennies |
public int getMax ( ) | Returns the maximum balance in pennies |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.