Describe the rectangle, draw it, calculate its area.
This is a straightforward example showing how to use both the input and the
output gizmos. This program animates, but you will need to adjust the input
gizmos to see any change in the graph.
Every cycle of the loop code does the following:
Clears and sets up the graph.
Gets the x- and y-coordinates, the width, and the height for the
Draws the rectangle.
Calculates the area of the rectangle.
Outputs the rectangle's area.
Running the example program
Run the program, and you should see the drawing of the rectangle. Also, you
should see the value for the area of the rectangle displayed in an output gizmo
Now try changing the width of the rectangle by clicking on the plus or minus
buttons of the input gizmo named 'width'. You should see the rectangle
change appropriately, and the new area should be displayed.
It is interesting to see what happens to the rectangle when the width or
height go to zero or take on negative values. Be sure to check this.