go to previous page   go to home page   go to next page

Answer:

You would expect to use:

  1. height,
  2. radius

Any other attributes of a cone can be calculated from these two.


Specifications for the Cone class

Right Circular Cone

Object oriented design means deciding what classes you need, what data the objects hold, and how the objects will behave. Let us do that with the Coner class.



Cone

A class that represents right circular cones

Variables

Constructors

Methods


Instance variables (like height) are usually made private so that only the constructors and methods of the object may access them. The set methods may be used to change the values in selected instance variables and get methods may be used to access the values. (More on this later.)

Constructors are usually made public.

Make public methods that are to be used outside of the object. (For now, all our methods.)


QUESTION 2:

Could a main() method create a Cone object?


go to previous page   go to home page   go to next page