I need help finishing a JavaFX GUI program with exception handling to play a simple game of
Question:
I need help finishing a JavaFX GUI program with exception handling to play a simple game of Hangman. The program will read from a dictionary file that I will provide in a zip file. The user should guess the letter until they either guess the word or run out of guesses. I will provide a GUI shell for the game. The shell sets up all of the GUI components, but I will need to write 2 more methods: the chooseWord and the handleGuessField method.
Link for the necessary files to make it easier for you: https://drive.google.com/file/d/16sUWxEekPH_MMeNzKJFQW0M9ub7bNa2I/view?usp=sharing Please take your time and I appreciate any help. The program shouldn't be "perfect" and I will commend any help received. -Some rules apply:
- The user gets a max number of wrong guesses
-Capitalization should be ignored
-Same letter guesses should only count once towards the max # of wrong guesses
-All instances of the correct letter should be revealed.
--Code Context Explanation--
-currentWordText: displays the word using "-" for characters not yet guessed
-outcomeText: displays the outcome of each guess or the game (e.g, right/wrong guess, game won/lost)
-wrongGuessesText: lists the wrong guesses the user has made
-wrongGuessNumberText: displays ow many wrong guesses the user has made
--chooseWord method-- This method randomly chooses a word from the library provided in the zip. If a file is missing, the outcomeText should display an error message. The guessField should then be disabled because the game can't be played. The program shouldn't crash or throw other exceptions
--handleGuessField method-- This method will respond to the user (guessField). This is the method that will make the game run. It reads a users guess and checks if it's valid. If it isn't, then it updates the displays to say so. And if the guess is valid, check to see if the user has guessed the letter already. If they have, update the displays. If it's a new guess, check if it's right or wrong and update the displays. Check if the game is over.
- Additional helper methods like "isGuessValid, updateDisplays, getDisplayVersionOfSWord, etc"
--Exception Handling Explanation--
-I need help adding exception handling to the code to cover three situations:
1. The user enters an empty guess
2. The user enters a guess that is longer than one character (aa or zb)
3. The user enters a guess that is not a letter (like + or $)
Whenever each happens I need to throw an object of the exception type created for it. Program should catch the exceptions and update the displays.
Introduction To Leadership Concepts And Practice
ISBN: 9781544351599
5th Edition
Authors: Peter G Northouse