Exemplo n.º 1
0
  public static void main(String[] args) {
    // Figure f = new Figure(10, 10);
    Rectangle r = new Rectangle(9, 5);
    Triangle t = new Triangle(10, 8);

    System.out.println("Pole: " + r.area());
    System.out.println("Pole: " + t.area());
  }
  @Test
  public void sixFor2x3Rectangle() throws Exception {
    Rectangle rectangle = new Rectangle();
    rectangle.setHeight(2);
    rectangle.setWidth(3);

    assertEquals(6, rectangle.area());
  }
Exemplo n.º 3
0
  public static void main(String arags[]) {
    //        Rectangle myRect;
    //        myRect = new Rectangle();
    //        myRect.width = 40;
    //        myRect.height = 50;

    Rectangle myRect = new Rectangle(40, 50);
    System.out.println("myRect's area is " + myRect.area());
  }