while i do know do basic programming i am not familiar with java the best i can do is provide a source code type guide for you, would that help?
Comment has been collapsed.
Do your own homework. Unless you want code in COBOL then I will gladly give it to you.
Comment has been collapsed.
^ what he said, its not really hard man, its just some simple conditioning you need to setup but if you still need help ask away
Comment has been collapsed.
import java.util.Scanner;
public class Hangman {
public static void main(String[] args) {
int attempts = 10;
int wordLength;
boolean solved;
Scanner userInput = new Scanner(System.in);
System.out.println("OK Guessing Player ... turn around, while your friend enters the word to guess!\n");
System.out.println("Other Player ? Enter your word (letters only, no repeated letters and not case sensitive):");
String secretWord = userInput.next();
for(int i = 1; i <= 20; i++)
System.out.print("\n");
Scanner userLetter = new Scanner(System.in);
String letter;
System.out.print("Word to date: ");
for (int i = 0; i < secretWord.length(); i++)
{
System.out.print("*");
}
while (attempts <= 10 && attempts > 0)
{
System.out.println("\nAttempts left: " + attempts);
System.out.print("Enter letter: ");
attempts--;
}
System.out.println("\n---------------------------");
System.out.println("Sorry you didn't find the mystery word!");
System.out.println("It was \"" + secretWord + "\"");
}
Comment has been collapsed.
honestly doesn't matter what he uses, could be his compiler is not set up correctly.
Comment has been collapsed.
pretty sure he did the english is a bit to good and no offense I doubt it is your native language.
And also this code will not satisfy your requirements for the project.
You need to think this through first before coding.
Comment has been collapsed.
I can help you think this through but you need to do your own coding, mostly since I really know only C++, python and some older languages only, just started to teach myself java and I kind of hate how clunky it feels. Before I start have you been keeping up with the class or have you fallen behind and you still have no idea how to write a hello world program
Comment has been collapsed.
when googling for an answer:
Try to find a solution, not a another problem. The code you posted is from here: http://stackoverflow.com/questions/4988143/simple-java-hangman-assignment and obviously the OP of this code did not get his program to work properly.
When you google "public class Hangman { public static void main(String[] args)" you find lots of examples (again, make sure it's a solution, not a problem).
Also: do your homework alone (it#s for your own good, how else are you supposed to understand what the code does?).
Since displaying the hangman graphically is optional, this is a rather trivial task, good luck ;)
Comment has been collapsed.
83 Comments - Last post 1 minute ago by hiddendoom45
2 Comments - Last post 5 minutes ago by Chris76de
56 Comments - Last post 1 hour ago by MyrXIII
292 Comments - Last post 3 hours ago by WaxWorm
252 Comments - Last post 7 hours ago by WaxWorm
795 Comments - Last post 15 hours ago by FranckCastle
364 Comments - Last post 15 hours ago by Zepy
9,621 Comments - Last post 26 seconds ago by CurryKingWurst
58 Comments - Last post 9 minutes ago by RePlayBe
57 Comments - Last post 9 minutes ago by Ratz0
548 Comments - Last post 19 minutes ago by Myklex
2,329 Comments - Last post 25 minutes ago by Prosac
137 Comments - Last post 26 minutes ago by RePlayBe
643 Comments - Last post 27 minutes ago by RePlayBe
Project: Hangman
Problem Description:
Write a program which plays Hangman with TV series names. Hangman is a game where a user given a fix number of tries to find a secret word. Your program must choose a random word from the word list below and must allow the user to guess maximum 10 characters from the alphabet before printing gameover. If user can guess the whole word before 10 characters user wins.
Wordlist : Merlin, Dexter, The Closer, House, Friends, Survivor, Simpsons
String s1 = “Hello”;
String s2 = “World”;
boolean r= s1.equals(s2);
public char charAt(int index)
Your program must check to make sure user enters characters one by one.
After each guess program diplays current word which shows correctly guessed characters and hides not guessed charachters. For example:
t _ ( You have 5 guesses left)
You can also display the state of the hangman graphically . At the end of the game whether user wins or fails, program asks user whether he/she wants to play the game again. If user presses ‘y’ or ‘Y’, game starts again, else program ends.
Comment has been collapsed.