Part I: The Game (70 points) I've provided a GUI shell for the game. The shell...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear. Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) Part I: The Game (70 points) I've provided a GUI shell for the game. The shell sets up all of the GUI components. You will complete two methods: the chooseWord method and the handleGuessField method. Your game must follow these rules: The user gets a pre-defined maximum number of wrong guesses. (My example program uses 7.) The game should ignore the capitalization (upper or lower case) of guesses. If a user guesses the same wrong letter twice, this letter should only count once towards the maximum wrong guesses. Correct guesses do not count towards the maximum wrong guesses. If the user guesses a correct letter, all instance of that letter should be revealed. The provided file uses several text components that you will update throughout the program: currentWord Text: displays the word using "-" for characters not yet guessed outcomeText: displays the outcome of each guess or the game (e.g., right guess, wrong guess, game won, game lost) wrongGuessesText: lists the wrong guesses the user has made wrongGuess NumberText: displays how many wrong guesses the user has made chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. chooseWord method (20 points) This method randomly chooses a word. The method should read in words from a file (such as words.txt, provided) and randomly choose a word. The method should also provide code to account for a missing file. In this case, the outcomeText should display an error message (such as "Error: No dictionary."). The guessField should then be disabled because the game cannot be played. The program should not crash or throw other exceptions. Hint for testing: Print out the randomly selected word you are trying to guess. This makes for much easier testing! handleGuessField method (50 points) This method responds to the user guess (typed into the guessField). This is basically the method that makes the game run! In this method, you should read in the user's guess and check if it is valid. If it's not valid, update the displays. If the guess is valid, you should check if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it is right or wrong and update the displays. Then also check if the game is over (either the user guessed the word and won or reached the maximum wrong guesses and lost). For full credit: add additional helper methods. Do not have the entire game logic in the handleGuessField method. Some examples of helpful methods might be isGuessValid, updateDisplays, getDisplayVersion OfSWord, etc. create whatever instance data variables you need to keep track of things. Some examples might be a list that keeps track of guessed characters, an array that keeps track of whether each character in the word has been guessed, the number of wrong guesses, etc. reduce duplicated code You can add code to the start() method to initialize variables and/or invoke helper methods. I strongly recommend getting the game working before moving on to Part II. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear. I strongly recommend getting the game working before moving on to Part II. Part II: Exception Handling (30 points) Add exception handling to cover three erroneous occurrences. Note: I realize you could write a working game that accounts for these situations without using exception handling. But, for this project, you are required to use exception handling. For all three situations, create your own exception type(s) to represent the situation. When the situation occurs, throw an object of the type you just created. The program should catch the exception(s) and update the displays. . The user continues to guess after invalid guesses. Invalid guesses does not count against the user's wrong guess count. Erroneous situations: 1. The user enters an empty guess 2. The user enters a guess that is longer than one character (like aa or zb) 3. The user enters a guess that is not a letter (like + or $) Hint: check out the Character class for help with detecting this situation! Your program method should not terminate or crash because of any of these thrown exceptions. All thrown exceptions should be caught and handled and the game should continue. Extra Credit: 15 points Allow the user to play multiple games. Add a "play again" button that is only visible when the game is over. Choose a new random word for each game. Sample Program and Project Files Below is a sample program you can run. For this program, the game only chooses between three words, to make it easier for you to guess! The words are apple, banana, and pear.
Expert Answer:
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
Suppose you want to have $600,000 for retirement in 25 years. Your account earns 7% interest. a) How much would you need to deposit in the account each month? $ b) How much interest will you earn? $...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Elena, a student in F-1 immigration status from Romania, is on the basketball team. She arrived in the U.S. on June 18, 2023 on a full athletic scholarship that includes $10,000 for her room and...
-
Find the least squares straight line fit to the three points (0, 0), (1, 2), and (2, 7).
-
In the previous exercise, let p be the probability that the baserunner steals second base successfully. For which values of p would you as manager call for an attempted steal? Data from previous...
-
Titanium Metals Corporation (TIMET) is one of the worlds leading producers of titanium products. In November 2012, it was announced the company was being purchased by Precision Castparts, a...
-
Bennett Construction Company is a building contractor specializing in small commercial buildings. The company has the opportunity to accept one of two jobs; it cannot accept both because they must be...
-
Halep Inc. borrowed $10,108 from Davis Bank and signed a 7-year note payable stating the interest rate was 11% compounded annually. What is the interest portion of the payment for year 1? Round to...
-
Dwight Donovan, the president of Donovan Enterprises, is considering two investment opportunities. Because of limited resources, he will be able to invest in only one of them. Project A is to...
-
8 . Suppose you considering whether to invest in Tesla and Google stocks. You believe that in 2 0 2 4 , the probability of an upside in tech stocks is 0 . 6 , while the probability of an unfavorable...
-
The human body has a blood volume of about 5 liters (p = 1060 kg / m3). The total volume of blood with a cell density of 1225 kg / m3 turned out to contain 1% white blood cells and 44% red blood...
-
A condensed income statement for Koontz Productions and a partially completed vertical analysis follow. Required: 1. Complete the vertical analysis by computing each missing line item as a percentage...
-
A company uses the following standard costs to produce a single unit of output. Direct materials Direct labor 6 pounds at $0.90 per pound Manufacturing overhead 0.5 hour at $12.00 per hour 0.5 hour...
-
Using analogical reasoning, explain how the facts of the Anderson case could be used to support Mrs. Smith case? My understanding basically is both cases are similar due to both plaintiffs got...
-
What value is the arrow pointing at? Write your value down to the correct number of digits. The value of the arrow's position is: 10
-
Vana Equipment Bhd (VEB) has a sophisticated stock reporting system that tracks stock movements throughout its distribution network. A 50% mark-up is automatically added to the costs of goods when...
-
Explain the term global capital markets. This chapter primarily discusses global equity markets. What other types of financial instruments are traded in these markets? How important are global...
-
Below, we will investigate the profit maximizing choice in the two steps that first involve a strict focus on the cost side. A: Consider again (as in the previous exercise) a production process that...
-
Confirmation Bias, Politics, Research and Last-Minute Studying: Individuals have lots of assumptions about the way the world works, assumptions that help frame how they make decisions. These...
-
In 1973, the OPEC countries sharply reduced the supply of oil in the world market raising the price of oil and thus the marginal cost of producing gasoline in domestic refineries. In 2008,...
-
The 2015 annual report of The Procter & Gamble Company (P&G) is available at www.pginvestor.com. After reviewing P&Gs annual report, respond to the following questions: a. Prepare common-size income...
-
Consider a publicly held company whose products you are familiar with. Some examples might include: Access the companys public website and search for its most recent annual report. (Some companies...
-
The following balance sheet and income statement data were taken from the financial records of The Dana Point Company: \ Required Prepare percentage change and common-sized balance sheets and income...
Study smarter with the SolutionInn App