I'm trying to write an AreaTester program that constructs a Rectangle object and then computes and prints its area. So far, I have gotten here, but I don't know how to find the area. I have been stuck for an hour.
import java.awt.Rectangle;
import java.awt.Color;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class AreaTester
{
int width, height;
public static void main(String[] args)
{
Rectangle box = new Rectangle(12,12,4,4);
// Print information about rectangle
System.out.print("Width: ");
System.out.println(box.getWidth());
System.out.print("Height: ");
System.out.println(box.getHeight());
System.out.print("Area: ");
}
}