/**
* Auto Generated Java Class.
*/
import java.util.*;
public class Hangman {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int guess;
boolean revealed[] = {false, false, false, false, false};
String word [] = {"c", "a", "n", "a", "d", "a"};
String letter;
while (guess > word.length){
letter = input.next();
if (letter.substring(guess, guess + 1)==word[guess] ){
revealed [guess] = true;
System.out.println(word[guess]);
}
else
{
System.out.println("you lost");
}
}
}
}
/* ADD YOUR CODE HERE */
}
i am not sure how to make the program check if the letter entered by the user matches the one in the array. also i am not sure how to make the program run again with a new word.
This post has been edited by macosxnerd101: 10 June 2014 - 09:44 PM
Reason for edit:: Please use code tags

New Topic/Question
Reply


MultiQuote


|