I can't seeem to get this code to work. I have several different classes listed out, and they extend each other. The code for the box super, however, tends to not think it is the first constructor.
public class Rectangle3
{
// instance variables
private int length;
private int width;
/**
* Constructor for objects of class rectangle
*/
public void Rectangle(int l, int w)
{
// initialise instance variables
length = l;
width = w;
}
// return the height
public int getLength()
{
return length;
}
public int getWidth()
{
return width;
}
}
Then the next one
public class Box3 extends Rectangle3
{
// instance variables
private int height;
/**
* Constructor for objects of class box
*/
public void Box(int l, int w, int h)
{
// call superclass
super (l, w);
// initialise instance variables
height = h;
}
// return the height
public int getHeight()
{
return height;
}
}
then the cube...
public class Cube3 extends Box3
{
//instance variable
private int depth;
/**
* Cube constructor class
*/
public void Cube(int l, int w, int h, int d)
{
//super call
super(l, w, h);
//initialization of instance variable
depth = d;
}
//return call to depth
public int getDepth()
{
return depth;
}
}