The completed parameter list is seen below. Of course, you can pick whatever names for the parameters you want, as long as they are legal identifiers.
public class Cone
{
// instance variables
private double radius; // radius of the base
private double height; // height of the cone
// constructor
public Cone( double rad, double hei )
{
= rad;
= hei;
}
// methods
}
In this constructor, the parameter list uses two parameters to match the two instance variables that will be initialized.
Note: In most classes there is NOT an exact match between the parameters of a constructor and the instance variables. There may be fewer (or more) parameters than instance variables.
Also, the constructor's parameters do not have to be in the same order as the instance variables (doing this helps you keep things straight, but the compiler does not care).
Now fill in the assignment statements to complete the constructor.