MPL Assignmnts Quesitions
MPL Assignmnts Quesitions
a. Declare one private object attribute: balance; this attribute will hold the current (or
"running") balance of the bank account.
b. Declare a public constructor that takes one parameter, initBalance, which populates the
balance attribute.
c. Declare a public method getBalance that retrieves the current balance.
d. Declare a public method deposit that adds the amount parameter to the current
balance. The deposit method is to always return true, meaning all deposits are
successful.
e. Declare a public method withdraw that removes the amount parameter from the current
balance. The withdraw method is to check that the amount being withdrawn is not
greater than the current balance. If amt is less than balance, then subtract the amount
from the balance and return true; else, leave the balance alone and return false.