ProtectedAccount.java is another basic class of a package of bank accounts. It encorperates a pin protection on the accounts. This class is abstract. This class extends BasicAccount.
ConstructorReceives: the name and pin of the person owning the account:
Postcondition: superclass constructor has been called, the pin has been set:
Basic method to do a deposit.Receives: the amount of the deposit and a trial pin
Postcondition: If the pin matches and the amount is positive, the amount is deposited in the account.
Basic method to do a withdraw.Receives: the amount of the withdraw and a trial pin
Postcondition: If the pin matches, the amount is positive, and the amount is less than the balance, then the amount is deposited in the account.
Back to the package documentation index