
import java.io.*;

/**
 * An example of reading from standard input.
 */
public class Doctor {
    
    static BufferedReader in =
        new BufferedReader(new InputStreamReader(System.in));

    /**
     * Use psychology on the user until they feel really great.
     * The arguments are ignored (of course!).
     */
    public static void main(String args[]) {
        String feeling;

        try {

            System.out.print("How do you feel? ");
            feeling = in.readLine();
            while (!feeling.equals("great")) {
                System.out.print("That's nice. How do you feel now? ");
                feeling = in.readLine();
            }

            System.out.print("How great, on a scale from 1 to 10? ");
            double greatness = Double.parseDouble(in.readLine());
            while (greatness < 9.9) {
                System.out.println("That's not good enough.");
                System.out.print("How about now? ");
                greatness = Double.parseDouble(in.readLine());
            }

            System.out.println("I'm glad.");

        } catch (IOException e) {
            System.out.println("Oops, some kind of problem here:" + e);
        } catch (NumberFormatException e) {
            System.out.println("You don't play fair: " + e);
        } catch (NullPointerException e) { // indicated end-of-file (ctrl-D)
            System.out.println("Impatient, aren't we?");
        } finally {
            System.out.println("Bye now!");
        }
    }
}

