Question
GuessingGamePhase2 Parts 1, 2, and 3 - capturing output with three (3) run examples: 1) player guesses on the first turn, 2) the player guesses
GuessingGamePhase2 Parts 1, 2, and 3 - capturing output with three (3) run examples: 1) player guesses on the first turn, 2) the player guesses before turns exhausted, and 3) user does not guess correctly (turns are exhausted) The same input phrase, or different phrases, can be used in getting the three test captures.
Part 1 Multiple Turns - a new int variable to store the turn the player is playing ( turn ), and initialise to one (1, first turn) - a new int variable to store the maximum number of turns ( maxTurns ) this is calculated after phrase has a String maxTurns = phrase.length() / 2; // # of turns is (# of chars / 2) - after the display of the phrase, and before the prompt for the players guess, add a DO_WHILE loop (DO_WHILE is probably the best, because we want the player to make at least one guess)
Part 2 BUT WHAT IF THE PLAYER GUESSES CORRECTLY? Currently, the loop only stops when the turns are exhausted, but not if the player guesses correctly!! There are at least two (2) options to solve this (choose only one):
1. Modify the program so that before the random character is picked, the phrase is provided by the player, which permits really interesting games. Consider phrases such as, "AAAAAA" and "123 applejacks!" (recall, punctuation is cleaned). (and make sure maxTurns is calculated after the phrase is input) 2. Also, currently, a turn is used up when the players guess is incorrectbut also when it is invalid (player guess not in the phrase
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started