
import java.util.Scanner;

/**
 * Asks the user to guess a name until they get the right answer.
 * Rumpelstiltskin!
 * 
 * @author Zach Tomaszewski
 * @version 26 Oct 2007
 */
public class NameGuesser {

  public static void main(String[] args) {
    
    String name = "Rumpelstiltskin";
    Scanner input = new Scanner(System.in);   
    boolean guessedRight = false;
    
    while (!guessedRight) {

      System.out.print("Can you guess my name? ");
      String guess = input.nextLine();
    
      if (guess.equalsIgnoreCase(name)) {
        System.out.print("Oh drats!  You guessed it");
        if (guess.equals(name)) {
          System.out.println(" (and you got the case right too!)");
        }else {
          System.out.println();
        }
        guessedRight = true;
      }else {
        System.out.println("No, that's not right.  Guess again!");
      }
    }
    
    System.out.println("Done.");    
  }
  
}//end class
