Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.*;
  2. public class Hangman
  3. {
  4. public static void main(String[] args)
  5. {
  6. Scanner scan=new Scanner(System.in);
  7. String[] words= {"word", "one", "two", "three", "four", "urine", "five", "raising", "six", "eight", "hood", "computer", "cocks", "pizza", "abuse", "domestic", "domino", "donut", "television", "rhythm"};
  8. int randomNum=(int)(Math.random()*20);
  9. String hungWord =words[randomNum];
  10. for()
  11. System.out.println(hungWord);
  12. for(int i=0;i<10;i++)
  13. {
  14. System.out.println("Guess Letter: ");
  15. char guessLetter=scan.next().charAt(0);
  16. for(int j=0;i<hungWord.length()+1;j++)
  17. if(hungWord.charAt(j)==(guessLetter))
  18. System.out.println("Correct Guess.");
  19. else
  20. System.out.println("Incorrect Guess.");
  21. //equal to
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement