// Aaron Tan
// MyRectangleDriverV2.java
// Test out the MyRectangle class
// This program asks the user for 2 opposite points of
// a rectangle, and computes the area of the rectangle.
// This version differs from MyRectangleDriver.java only
// in the input part and the creation of the MyRectangle object.

import java.util.*;

public class MyRectangleDriverV2 {

   public static void main(String[] args) {

      Scanner stdIn = new Scanner(System.in);

      System.out.print("Enter 1st point's x- and y- coordinates: ");
      int x1 = stdIn.nextInt();
      int y1 = stdIn.nextInt();

      System.out.print("Enter 2nd point's x- and y- coordinates: ");
      int x2 = stdIn.nextInt();
      int y2 = stdIn.nextInt();

      MyRectangle rect = new MyRectangle(x1, y1, x2, y2);
      
      // Display the rectangle
      System.out.println(rect);

      // Display the area of the rectangle
      System.out.println("Area = " + rect.computeArea());

   } 

}


