Write the definition of a class, swimmingPool, to implement the properties of a
ID: 3547655 • Letter: W
Question
Write the definition of a class, swimmingPool, to implement the properties of a swimming pool. Your class should have the instance variables to store the length (in feet), width (in feet), depth (in feet), the rate (in gallons per minute) at which the water is filling the pool, and the rate (in gallons per minute) at which the water is draining from the pool. Add appropriate constructors to initialize the instance variables. Also add member functions, to do the following: Determine the amount of water needed to fill an empty or partially filled pool; the time needed to completely or partially fill the pool, or empty the pool; add water or drain for a specific amount of time.
Explanation / Answer
class swimmingPool{
int length;
int width;
int depth;
double rateWaterFilling;
double rateWaterDraining;
public swimmingPool(){
length =0;
width = 0;
depth = 0;
rateWaterFilling =0;
rateWaterDraining = 0;
}
public swimmingPool(int l,int w,int d,double rf,double rd){
length =l;
width = w;
depth = d;
rateWaterFilling =rf;
rateWaterDraining = rd;
}
public int amountWaterNeeded(){
}
public double timeNeededToFill(){
}
public double timeNeededToEmpty(){
}
public void addWaterForTTime(){
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.