


class Box {

	// Fields  - data held by an INSTANCE of the class
	private int width = 0;
	private int height = 0;
	private int length = 0;

	// Constructor
	public Box(int w, int h, int l) {
		width = w;
		height = h;
		length = l;
	}

	// Getters
	public int getWidth() {
		return width;
	}
	public int getHeight() {
		return height;
	}
	public int getLength() {
		return length;
	}

	// Setters
	public void setWidth(int w) {
		if (w <= 0) {    // input validation
			width = 1;
		}
		else {
			width = w;
		}
	}
	
	public void setHeight(int h) {
		if (h <= 0) {    // input validation
			height = 1;
		}
		else {
			height = h;
		}
	}

	public void setLength(int l) {
		if (l <= 0) {    // input validation
			length = 1;
		}
		else {
			length = l;
		}
	}

    // Get the volume of the box
	public int getVolume() {
		return width * height * length;
	}

	// Override the Object's toString()
	@Override
	public String toString() {
		String s = "w:" + width;
		s += " h:" + height;
		s += " l:" + length;

		return s;
	}
}




