// Describe the program

// Any imports
import java.io.*;
import java.util.*;

// class specification
public class DoubleTestExcp {
  public static void main(String[] args) {

    // Initialize

    String doubleString;
    double doubleVal1 = 0.0;
    double doubleVal2 = 0.0;
    Double doubleObject;

    // Output instructions to the user
    // Prompt for data (Show ME the Data!)
    System.out.println("Enter a String to convert to double or End to quit");
    doubleString = ConsoleInput.readLine();

    // While it's not the end of data
    while ( !doubleString.equalsIgnoreCase("End") )
    {
      // Process the data
      process: {
        try {
          System.out.println("Try block entered");
          doubleObject = new Double(doubleString);
          doubleVal1 = doubleObject.doubleValue();
          doubleVal2 = Double.parseDouble(doubleString);
        }
        catch (NumberFormatException nfe) {
          System.out.println("Sorry, this is an invalid number - please try again!");
          System.out.println("\nThe execption was:\n" + nfe);
          break process;
        }

        // Output some results
        System.out.println("doubleVal1: " + doubleVal1 + "  doubleVal2: " + doubleVal2);
     }  // end process
      // Prompt for more data
      System.out.println("Enter a String to convert to double or End to quit");
      doubleString = ConsoleInput.readLine();
    }

    // Preform the wrap-up processing
    System.out.println("Thank you!");

    // Output any final results

  } // end main
} // end class