import java.io.*;

public class RectangleTest
{
  public static void main(String[] args) throws IOException
    {

      // This program reads the height and width for a rectangle from the user.
      // The rectangle's area and circumference are printed.
      
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

      double rLength, rWidth;
      int count = 0; 

      while(count < 1)
      try
	{
	  
	      System.out.println("Please enter the rectangle's lenth: ");
	      rLength = Double.parseDouble(in.readLine());

	      System.out.println("Please enter the rectangle's width: ");
	      rWidth = Double.parseDouble(in.readLine());

	      if((rLength <= 0) || (rWidth <= 0))
		throw new RuntimeException("The length and width must be positive");
	      count++;

	      Measurable r = new Rectangle(rLength, rWidth);

	      System.out.println("The area is: " + r.area());
	    
	}
      catch(RuntimeException e)
	{
	  System.out.println(e.getMessage());
	}
    }

}
