Tino APCS

DrawingTool

You have already been looking at an API for DrawingTool. The purpose of Handout A1.1 was to give you an introduction to the purpose of the class and how to use its various methods.

When instructed to draw a circle, you probably looked at Handout A1.1 and saw this:

public drawCircle (double r);

postcondition

-If the object is in drawing mode, a circle of radius r is drawn around the current location using the current width and color.

This tells us exactly what we need to know to use this method. We have the name of the method and the type of argument it takes. We also know what will happen after the method is called.

This is not the official Java format for an API, but it accomplishes the same thing. Without this handout, how would you have known how to draw a circle? How about when you made the picture of the house? How would you have known to use the forward method, turnLeft, down, or up? As you can see, APIs are an essential tool that must be looked at before a programmer can understand how to use pre-made classes.

Last modified: December 12, 2022

Back to Final And Static

Dark Mode

Outline