The wording in 4) suggests that you don't need to calculate the winnings on the fly lines 90 and 94. Keep track of the number of guesses and pass that value to a function called calcWinnings() which is called on line 81 . Use the value passed in as the conditional in the switch statement. The switch statement will look a lot like the printPayout function except that it will use case statements indicating what the winnings are based on the value passed in. The return value of the function can be stored in the variable winnings and that value added to the bank.
Except for possible case sensitivity considerations it looks like you already have 3) completed.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
Add another conditional to the inner while loop. The inner loop should continue if the number of guesses is less than 8 and the correct number hasn't been guessed. Use a flag to keep track of whether the correct number has been guessed, maybe a boolean variable called notguessed set to default true each new "game" and changed to false if c == 0.
Move everything except changing the notguessed flag and the break statement in the if c == 0 scenario outside of the inner while loop and place it after the inner while loop and before the restart of the outer while loop.
Determine why the inner file loop stopped. If it was because the correct answer was guessed then output congratulatory response. If it was because the correct value wasn't guessed in 8 tries, then deduct the appropriate amount from the appropriate variable.
In either case indicate the current "winning" or "bank" value or whatever and ask if they want to play another game.
Be sure to set all necessary flags and counters to the appropriate default values before each game is played.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396