Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I got 58% for Cengage score , I will add The code word and screen shoot of it. Please help me to got 100%. Question

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedI got 58% for Cengage score , I will add The code word and screen shoot of it. Please help me to got 100%. Question Instructions 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, if the water in the pool exceeds the total capacity of the pool, output "Pool overflow" to indicate that the water has breached capacity. The header file for the swimmingPool class has been provided for reference. Write a program to test your swimmingPool class. An example of the program is shown below: Pool data: Length: 30 Width: 15 Depth: 10 Total water in the pool: 0 To completely fill the pool: Enter water fill-in rate: 10 Time to fill the pool is approximately: 56 hour(s) and 6 minute(s). Make sure you are checking your work by running the tasks throughout your development process. Grading When you have completed your program, click the Submit button to record your score. 126127128129130131132133134135136 (double l, double w , double d , double fi , double fo , double wInPool) : length(l), width(w), depth(d), waterFlowInRate(fi), waterFlowOutRate(fo), amountOfWaterInPool(wInPool) {} Code swimmingPool.h const double GALLONS_IN_A_CUBIC_FEET = 7.48; class swimmingPool { public: void set(double l = 0, double w = 0, double d = 0, double fi = 0, double fo = 0, double wInPool = 0); void setLength(double l); void setWidth(double w); void setDepth(double d); void setWaterFlowRateIn(double fi); void setWaterFlowRateOut(double fo); void addWater(double time, double fillRate); void drainWater(double time, double drainRate); double poolTotalWaterCapacity(); double getLength(); double getWidth(); double getDepth(); double getWaterFlowRateIn(); double getWaterFlowRateOut(); double getTotalWaterInPool(); int timeToFillThePool(); int timeToDrainThePool(); double waterNeededToFillThePool(); swimmingPool(double l = 0, double w = 0, double d = 0, double fi = 0, double fo = 0, double wInPool = 0); //Constructor private: double length; double width; double depth; double waterFlowInRate; double waterFlowOutRate; double amountOfWaterInPool; }; -------------------- swimmingPool.cpp #include "swimmingPool.h" #include using namespace std; // function to set the length, width, depth, waterFlowInRate, waterFlowOutRate and amountOfWaterInPool void swimmingPool:: set(double l, double w, double d , double fi, double fo , double wInPool) { length = l; // feet width = w; // feet depth = d; // feet waterFlowInRate = fi; // gallons per minute waterFlowOutRate = fo; // gallons per minute amountOfWaterInPool= wInPool; // in gallons } // function to set the length void swimmingPool:: setLength(double l) { length = l; } // function to set the width void swimmingPool:: setWidth(double w) { width = w; } // function to set the depth void swimmingPool:: setDepth(double d) { depth = d; } // function to set waterFlowInRate void swimmingPool:: setWaterFlowRateIn(double fi) { waterFlowInRate = fi; } // function to set waterFlowOutRate void swimmingPool:: setWaterFlowRateOut(double fo) { waterFlowOutRate = fo; } // function to add water to the pool void swimmingPool:: addWater(double time, double fillRate) { // calculate the amount of water to add in gallons double waterToAdd = time*fillRate*GALLONS_IN_A_CUBIC_FEET; // check if adding the water will cause overflow, then display message and set amountOfWaterInPool to pool capacity if((amountOfWaterInPool+waterToAdd) > poolTotalWaterCapacity()){ cout 0) return remainingWater/waterFlowInRate; return 0; // waterFlowInRate is 0 } // function to calculate the time to completely drain the pool (in minutes) int swimmingPool:: timeToDrainThePool() { if(waterFlowOutRate > 0) // waterFlowOutRate > 0, calculate time return amountOfWaterInPool/waterFlowOutRate; return 0; // waterFlowOutRate is 0 } // function to calculate the total amount of water needed to fill the pool (in gallons) double swimmingPool:: waterNeededToFillThePool() { return(poolTotalWaterCapacity()-amountOfWaterInPool); } // constructor to initialize the pool fields swimmingPool::swimmingPool(double l, double w , double d , double fi , double fo , double wInPool) : length(l), width(w), depth(d), waterFlowInRate(fi), waterFlowOutRate(fo), amountOfWaterInPool(wInPool) {} //end of swimmingPoolImp.cpp ========================================== mian.cpp #include #include "swimmingPool.h" using namespace std; int main() { swimmingPool pool(30,15,10); double fillInRate; coutfillInRate; pool.setWaterFlowRateIn(fillInRate); int time = pool.timeToFillThePool(); cout 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, if the water in the pool exceeds the total capacity of the pool, output "Pool overflow" to indicate that the water has breached capacity. The header file for the swimmingPool class has been provided for reference. Write a program to test your swimmingPool class. An example of the program is shown below: Pool data: Length: 30 Width: 15 M1 Programming Assignment 1: Swimming Pool

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are the important facts related to this situation?

Answered: 1 week ago