Creating an exception class and using it in code
<p>Okay, Now that I've updated my code it looks like this:</p>

<pre><code>public static double getDouble (String userShape, String parameter) throws BadShapeData
{

String missingValue = parameter, value = "", shape = userShape;
String s2 = "Enter a value for " + missingValue;

value = JOptionPane.showInputDialog(s2);

if (null == value || value.length() == 0) {
throw new BadShapeData("Error, nothing was entered. Must be double.");
}
try {
return Double.parseDouble(value);
}
catch (NumberFormatException e) {
throw new BadShapeData("Error entering " + value + ". Must be double."); 
}
}
</code></pre>

<p>And this is also in my code :</p>

<pre><code>  public static void main(String args[]) {
  int choice;
  do {
       choice = menu();
       if(choice != 0) {
          System.out.println(makeShape(choice));
       }
   } while (choice != 0);
  }

  public static Shape3D makeShape(int choice) {
    if(choice == 1) 
      return new Cone(getDouble("Cone", "Radius"), getDouble("Cone", "Height"));
   else if(choice == 2) 
      return new Cylinder(getDouble("Cylinder", "Radius"), getDouble("Cylinder", "Height"));
   else if(choice == 3) 
      return new Sphere(getDouble("Sphere", "Radius"));
   else if(choice == 4) 
      return new Box(getDouble("Box", "Length"), getDouble("Box", "Width"), getDouble("Box", "Height"));
   else if(choice == 5) return new Pyramid(getDouble("Pyramid", "Base"), getDouble("Pyramid", "Height"));
   else return new Cube(getDouble("Cube", "Size"));
  }
</code></pre>

<p>However now the error I'm getting says "Error: unreported exception BadShapeData; must be caught or declared to be thrown" and is being highlighted where I use the getDouble method</p>
