/* * Definition of subclass Rect */ class Rect extends Shape { private int wid; private float aspect; public Rect (int xin, int yin, int widin, int htin) { x = xin; y = yin; // convert from given inputs to our internal data wid = widin; aspect = (float)widin/htin; } public void setSize (int widin, int htin) { wid = widin; aspect = (float)widin/htin; } public void draw() { System.out.println ("Drawing rectangle at " + x + ", " + y + ", " + wid + ", " + wid/aspect); } public float area() { return (float) (wid * wid / aspect); } }