(program design and development)
program design and
development
Create the class diagram for a class
named Circle with fields named radius, area, and diameter. Include
get methods for each field, but include a set method only for the
radius.
Also write the pseudocode for the
class and include a constructor that sets the radius to 1.
When the radius is set, do not allow
it to be zero or a negative number. When the radius is set,
calculate the diameter (twice the radius) and the area (the radius
squared times pi, which is approximately 3.14).
Code to go into the setRadius( )
method:
if rad <=
0 then
radius = 1
else
radius = rad
endif
diameter = 2 * radius
area = (radius * radius) *
3.14