import javax.swing.*;
public class GeometryUser {

	private IGeometry calc;  // supertype

	public GeometryUser() {
		String userInput = "";
		int x = 0;
		
	    userInput = JOptionPane.showInputDialog("1-sphere  2-cube  3-pyramid  4-Quit");
		x = Integer.parseInt( userInput );
		
		if (x == 1)
		  {
		  calc = new Sphere();	// subtype
		  }
		else if (x == 2)
		  {
		  calc = new Cube();	// subtype
		  }
		else if (x == 3)
		  {
		  calc = new Pyramid();	// subtype
		  }
		else
		  {
		  System.out.println("Exiting...");	
		  System.exit(0);	
		  }
		
		printer( calc );
		System.out.println( calc.perimeter() + " feet");		
		System.out.println( calc.area() + " sq. ft." );
		System.out.println( calc.volume() + " cubic ft." );
		

   } // end constructor

	
public void printer( IGeometry obj ) {
   obj.identify();
}
	


public static void main(String args [] ) {
		
		new GeometryUser();
		}
} // end class
