Swastik
I am afraid that isn't quite correct. The account object should behave like a real‑life account. You go to the bank and pay in £100 and they stamp the paying‑in book. Or nowadays, more likely, the ATM gives you a receipt. Nobody tells you how much you have in the account. You can ask for a balance separately. Similarly your account object should have deposit and withdraw methods, which don't return the balance. You have a separate getBalance method for that. The three actions are separate, and should therefore be handled by separate methods.Stacey Axe wrote:. . . I understand that when the amount is input into the withdraw that it should return the account balance minus the amount of the withdraw and . . .
But the logic is exactly the same. There are two ways to look at it:-Part one of this class dealt with Python and I was able to understand it, but Java is stumping me. I cannot seem to comprehend it. . . . .
You go to the bank and pay in $100 to your account, and your balance becomes that amount greater.
Those are the same thing in different languages (and different currenciesMan gehe zur Bank: man zahle €100 aufs Konto und der Saldo wird um diese Menge größer.
No more fooling around. Read this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|