Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Having difficulty writing a program for this that compiles and works. Please inc

ID: 3901926 • Letter: H

Question

Having difficulty writing a program for this that compiles and works. Please include the beggine too to see which files i need to include where

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, determine the time needed to completely or partially fill or empty the pool, and add or drain water for a specific amount of time. This program must have a main program that utilizes a header file that defines the class and an implementation file containing the constructions and functions used in the class definitions.

Explanation / Answer

void swimmpool::addWater(double time, double rate)

{

if((time * rate) + amountOfWaterInPool > poolTotalWaterCapacity())

{

amountOfWaterInPool = time * rate;

}

else

{

amountOfWaterInPool = (time * rate) + poolTotalWaterCapacity();

}

}

void swimmpool::drainWater(double time, double rate)

{

if(amountOfWaterInPool - time *rate < 0)

{

  

amountOfWaterInPool = 0;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote