Rectangle
- Class header
- Instance variables
- Constructor
- Accessor: getWidth
- Method: area
Square
- Class header
- Constructor
- etc.
AddConstant
- Constructor,
addTo
,setConstant
- Knows constant to add
{
AddConstant a = new AddConstant(5);
int x;
x = a.addTo(7); // gives x=12
x = a.addTo(80); // gives x=85
a.setConstant(3); // now does +3
x = a.addTo(7); // gives x=10
}
RainbowBug
- Straight 5 steps
- Change color: red -> green -> blue
- Repeat color changes forever