Looping Program Help

I've been having some problems with my program. Basically it is a bank menu where the persons balance is initially $0.00. When the user enters a deposit or withdrawal or both I need too make the balance option display the difference. SO if the user deposits 250.00 and withdraws 150.00 the balance when selected should read 100.00. But my balance regardless of the users input shows 0.

Last edited on
The code is outputting bankBalance on line 97 before it's calculated on line 99.


Edit: Also - check your logic - what if they deposit 500, withdraw 200, then deposit 100 - the balance should be 400. But the line 99 will subtract 200 from 100 leaving a balance of -100, since it's still holding on to the old bankWithdraw amount.
Last edited on
so how would I go about fixing the logical part?
I think of a bank balance as more of a running total of how much money is in the account. So if a deposit or withdrawal comes in, I think I'd update the balance right away. Then if someone wants the balance, I can just output the current balance, I don't need to calculate anything.
Last edited on
Topic archived. No new replies allowed.