Return to Snippet

Revision: 34900
at October 30, 2010 01:41 by LemonPro


Initial Code
// Creating Swimming pool class

public class SwimmingPool {

// constant

	private final float CAPACITY_CUBIC_FOOT = 7.48f;

// instance variable

	private float lengthOfPool;
	private float widthOfPool;
	private float shallwoDeptOfPool;
	private float deepDepthOfPool;
	private float volume;
	private float capacity;

// Constructor

public SwimmingPool (	float length,
			float shallowEndDept,
			float deepEndDepth)

{
	lengthOfPool = length;
	widthOfPool = width;
	shallowDeptOfPool = deepEndDept;
	}

// instance methods

public float volumeOfWater() {

	volume=0.5f*(lengthOfPool*widthOfPool)*(shallowDeptOfPool + deepDepthOfPool);
	return volume;
		}

public float capacityOfPool() {
	capacity = volume *CAPACITY_CUBIC_FOOT;
	return capacity;
		}

public float timeToFillPool (float rateOfFlow) {
	return (capacity / rateOfFlow) / 60.0f;
	}

}

Initial URL


Initial Description


Initial Title
Swimming Pool class

Initial Tags


Initial Language
Java