![]() |
Basic Java Class Help
Java hangman GuessPrase HELP!?
Create a GuessPhrasePanel class and implement the following (NOTE: Make sure your methods work the same for upper and lower case letters): a. Has a constructor taking a String guess phrase b. Shows all the letters in the phrase, initially just showing the underline for all alphabet letters (not the letter as it needs to be guessed). Spaces and other punctuation should be shown with no underline. c. setPhrase – sets a new phrase to this GuessPhrase object, gets rid of old phrase parts and creates new ones d. hasLetter – a method that returns whether or not a specified letter is in the phrase e. revealLetter – a method that reveals or shows a specified letter (if there are more than one of that letter, all should be revealed) f. isFullPhraseRevealed – returns whether or not the full phrase has been revealed g. revealFullPhrase – reveals the full phrase PLEASE HELP IM SO LOST I HAVE NO IDEA WHAT TO PUT IN THE METHOD BODIES AND IN MAIN. im just a beginner and my teacher refuses to offer help. I was given these instructions and i need to write my own code. this is what i was able to come up with. i got like 30-40% i think. but i dont know how to finish. if you can tell me how. to do these parts. what they are supposed to look like. if it needs an if statement or not or something like that. just some guidance im soo lost. please if you can suggest anything at all! if possible if you can write up the code id really appreciate it, im going to fail the class if i cant get this perfect. IM BEGGING YOU my code ------------------------------ Code:
import java.io.IOException; |
Quote:
Since you are using a gui though, the answer is simple: you don't put that in your main methods at all. You attach the event handlers for the keydowns or add a submit button and a ActionListener and chain the events to the method provided by the GuessPhrasePanel. So the main (which I wouldn't put in a panel class) is responsible for instantiating the frame, adding this panel, and attaching the listeners it requires. |
| All times are GMT +1. The time now is 10:18 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.