Since this is a checking account, you are required to enforce an invariant that the balance is never negative.With this invariant in mind,
a) (5pt) Explain why the given code is a bad design for the abstract data type BankAccount.
b) (15pt) Write down a better implementation for BankAccount in Java (or your favorite OO language).

Leave a Reply

Your email address will not be published. Required fields are marked *