Advertisement
Guest User

help

a guest
Dec 11th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. package test;
  2.  
  3. import java.util.ArrayList;
  4. import lib.TextIO;
  5.  
  6. public class Test {
  7.  
  8.     public static ArrayList<String> allLetters = new ArrayList<String>();
  9.     public static String userWord, userGuess;
  10.    
  11.     public static void main(String[] args) {
  12.         System.out.println("userWord");
  13.         userWord = TextIO.getlnString().toUpperCase();     
  14.         boolean game = true;
  15.         while (game == true) {
  16.             System.out.println("userGuess");
  17.             userGuess = TextIO.getlnString().toUpperCase();
  18.             allLetters.add(userGuess);
  19.             test();
  20.         }
  21.        
  22.     }
  23.    
  24.     public static void test() {
  25.         for (int i = 0; i < userWord.length(); i++) {
  26.             for (String t2heke : allLetters) {
  27.                 if (t2heke.equals(Character.toString(userWord.charAt(i)))) {
  28.                     System.out.print(t2heke.toUpperCase() + " ");
  29.                 } else {
  30.                     System.out.print("_ ");
  31.                 }
  32.             }
  33.         }
  34.         TextIO.putln();
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement