/*
* Definition of subclass Rect
*/
class Rect extends Shape { //*1 Rect inherits from Shape
private int wid, ht; //*2 ivars defined by Rect, no need to declare x and y
public Rect (int xin, int yin, int widin, int htin) {
x = xin; y = yin; //*3 ivars inherited from Shape
wid = widin; ht = htin; //*2
}
public void setSize (int widin, int htin) {
wid = widin; ht = htin; //*2
}
public void draw() {
System.out.println ("Drawing rectangle at "
+ x + ", " + y + ", " + wid + ", " + ht);
}
public float area() {
return (float) (wid * ht);
}
}