Box - { return height; } public double area() { return 2 *...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
i public class Box extends Rectangle { private double height; public Box() { super(); height = 0; } public Box(double l, double w, double h) { super(l, w); height = h; } public void setDimension(double l, double w, double h) { super.setDimension(l, w); if (h >= 0) height = h; else height = 0; } public double getHeight()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return height; } public double area() { return 2 * (getLength() * getWidth() + getLength() * height + getWidth() * height); } public double volume() { return super.area() * height; } public void print() { super.print(); System.out.print("; Height = " + height); } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Ask a homework question - tutors are online