Project 1 - Guess the Word Game
This exercise is to create a hang man type program. If you do not like the idea of a hang man image then use a different sequence of images (such as pushing someone out of the door bit by bit) as an alternative.
Your program should have a hidden word stored internally. (Initially use the word ‘hello')
The ‘X's in the labels char1, char2 etc., will represent the characters of the hidden word. (The first X represents ‘h', the second X represents ‘e', so all the characters of ‘hello' are shown as Xs)
The program user will guess one letter at a time (and type it into the textField and click on the button), and if they guess a letter which is in the hidden word then the appropriate ‘X' is replaced by the correctly guessed letter. The diagram shows that ‘e' and ‘l' have been guessed correctly.
Every time an incorrect letter is guessed then another part of the sequence of the hang man (or alternative) images is shown.
Follow the ‘Guess the Word' start guide on Blackboard to help you create the application. It is important that your program will work with any 5 or 6 letter word written once at the start of your program code (and not just the word ‘hello')
Initially, create the full final picture image, and then rub out a piece and save it as a different filename, then rub out another part and save it as a different name, etc. Use the images in your program in the reverse order to how you created the images, so the sequence will gradually build up to the full image being shown.
Code Extras
Work out a way to make the program display an appropriate ‘Game Over' message. For example, the message could display ‘Congratulations you have won. Game over. ' when the hidden word has been guessed before the final complete hang man (or alternative) image is displayed, or ‘You did not win. Game over.' when the word has not been guessed before the final image is displayed.
2. Make the program work for any length hidden word from 3 to 10 characters, and only display sufficient ‘X's to match the length of the hidden word.
3. Write 6 different hidden words into your program and make it chose a random word each time.
4. Read in a hidden word from a text file of words. The program should choose a random word from the file.
Java Program code to be submitted as a single text file by the date shown above on Blackboard ECSC410 ‘Submit Coursework' link. For this submission you should copy and paste all your code into ONE long text file, type the filename at the top of each piece of pasted code and write whether it is part 1 or 2 or 3 or 4 , and at the very top of the text file type your name and Unix account number. Call this large saved file by your ID number but start with GW (e.g. . GWw123456.txt ) and ensure it is saved as plain text (not .doc or .zip). Do not change your code after it has been submitted.
If Blackboard doesn't work at the last minute then upload the file within 24hrs of Blackboard working again. You do not need to email us as we will know Blackboard is not working. Be careful and double check your file as you can only upload once.