// The Square class is a subclass of the Widget class
// It inherits all attributes of Widget and adds a color attribute
class Square extends Widget {
// Attributes
// inherit x, y, s from Widget
// nothing new added here
// Constructor(s)
Square(float x, float y, float s) {
super(x, y, s); // Calling the Widget's constructor
} // Square()
// Methods
// inherits jiggle() from Widget
void display() {
push();
rectMode(CENTER);
fill(75);
stroke(0);
rect(x, y, s, s);
pop();
} // display()
// Print method: Overrides the one in Widget class
String toString() {
return "Square of size: " + s + " at <" + x + "," + y;
} // toString()
} // class Square