I need some assistants.
So I have to modify the Account class so that the balance variable can never become negative. You'll need to change the primary constructor and the deposit and withdraw methods. If the balance threatens to become negative, set it to zero instead. And the hint was. Use the math.max method to determine which is larer, the intended balance or zero.
How can I do this? Right now I'm at a blank.
This is very straightforward. Each pf those methods can change the balance, right? In each case, add or subtract the method argument to or from the current balance. If Math.max(balance, intendedBalance) == balance, then set balance to 0; otherwise, set it to the intended balance.
02-13-2011, 06:59 AM
Could you clarify taht a lot better? I'm still kind of confused.