



|
|
Byron's CSC212 Web Site
|
Class Notes
Wednesday September 13 , 2000
|
|
|
Circle Class and Classification
Class Notes --
Wednesday September 13 , 2000
CSC212 - September 13, 2000
================================
Lecture Topic: CIRCLE CLASS AND CLASSIFICATION
DEF: CLASSIFICATION is the process of grouping objects
having like properties (structural and behavioral)
into sets.
DEF: CLASS is a set of objects grouped together as a
result of classification .
DEF: INSTANCE of a class is an individual element of a
class.
DEF: OBJECT in the abstract, is a collection of "parts",
"behaviors", and "relations".
For practical programming purposes, an object is
either a class, or an instance of a class.
DEF: STATIC OBJECT sometimes referred to as a class.
DEF: DYNAMIC OBJECT sometimes referred to as an
instance of a class.
Remark: As an activity to acquaint us with the creation
and use of objects (ie scripting) we will solve
a collection of problems posed in the context
of a "Shapes World". A conceptual entity
consisting of circles, squares, rectangles,
triangles, and polygons. A realm in which
interesting computations on shapes abound.
The Circle Class: (Modeled in Java as a Class)
We will model a circle in terms of one number,
its radius, and the following programs.
This program is used to create a new circle whose
radius is the given number.
< > = instance of an item
new Circle (<double>) -> <Circle> // double = radius
<Circle>.radius() -> (double)
Compute the radius of the circle
<Circle>.diameter() -> <double>
Compute the area of the circle
<Circle>.perimeter() -> <double>
Compute the perimeter of the circle
<Circle>.describe()
Describe the circle
<Circle>.expand(<double>)
Increase the radius of the circle by the given amount
<Circle>.shrink(<double>)
Decrease the radius of the circle by the given amount
=========================================================
123456789112345678921234567893123456789412345678951234567
|
|
|