Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Hangman
- {
- public static void main(String[] args)
- {
- Scanner scan=new Scanner(System.in);
- String[] words= {"word", "one", "two", "three", "four", "urine", "five", "raising", "six", "eight", "hood", "computer", "cocks", "pizza", "abuse", "domestic", "domino", "donut", "television", "rhythm"};
- int randomNum=(int)(Math.random()*20);
- String hungWord =words[randomNum];
- for()
- System.out.println(hungWord);
- for(int i=0;i<10;i++)
- {
- System.out.println("Guess Letter: ");
- char guessLetter=scan.next().charAt(0);
- for(int j=0;i<hungWord.length()+1;j++)
- if(hungWord.charAt(j)==(guessLetter))
- System.out.println("Correct Guess.");
- else
- System.out.println("Incorrect Guess.");
- //equal to
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement