Why do You call the withdraw method 3 times here?
Seems like you should only call it once if it changes the balance of the account.
int balance1 = balance - (wager);
Does this code change...
Type: Posts; User: Norm
Why do You call the withdraw method 3 times here?
Seems like you should only call it once if it changes the balance of the account.
int balance1 = balance - (wager);
Does this code change...
Nor do I without seeing the code.
You don't say that subtracting twice is the wrong thing to do. It could be the right thing if the player were to make two wagers.
Is it working now?
What if the balance goes negative?
b1.withdraw(wager1,wager1);
Why do you pass the same amount as two arguments?
How does the withdraw method do the two steps listed in post #17?
What code do you have that does those two steps?
Why does it call itself to do this?
1) subtract the wager from the balance
2) return me that int.
What are the two statements that will do those two steps?
No, it should only do this for...
What is the withdraw method supposed to do?
Where in your code do you need to call the withdraw method to do that job?
Explain how you want your program to work.
A method calls itself
and that new invocation of the method calls itself
and that new invocation of the method calls itself
and that new invocation of the method calls itself
and that new...
It looks like you have a recursive call to the withdraw method. It should NOT be calling itself.
Please post the full text of the error message. Your edited version left off important information.
What happens when you execute the program? Can you copy the console and paste it here?
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select...
You've done a much better analysis of the OPs code. I usually wait to see if they come back.
Please copy and paste here the full text of the error message.