How would i do "Box entends Cube"
<p>I want to extend a Cube from Box. My program has three parts first i do a rectangle class then i use it to extend a Box class then i extend a Cube. I am stuck at the Cube part. This is what my instructions say :</p>

<p>Assessment Instructions
a. A Cube is a Box where the length, width, and height all have the same values.
b. You won’t have to add any additional instance variables or methods, but you
will have to set up the Cube’s constructor to ensure that length, width, and
height all have the same values.</p>

<p>Rectangle:</p>

<pre><code>    public class Rectangle
    {
        // instance variables 
        private int length;
        private int width;

        /**
         * Constructor for objects of class rectangle
         */
        public 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;
        }

    }
</code></pre>

<p>Box:</p>

<pre><code>public class Box extends Rectangle
{
    // instance variables 
    private int height;

    /**
     * Constructor for objects of class box
     */
    public 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;
    }

}
</code></pre>

<p>And the main  one Cube:</p>

<pre><code>class Cube extends Box{
    // instance variables 
    private int height;
        private int length;
    private int width;

    public Cube(int h,int w,int l){
        super(h,w,l);

    }

    public double getheight(){
        return height;

               }
        public double getlength() {
            return length;
        }

        public double getwidth() {
            return width;
        }
}
</code></pre>

<p>I need to know if I did the Cube one right or not. If i didn't do it right please help me fix it.</p>
