Write a C++ Program. Programs MUST compile and run. Also, do not forget proper d
ID: 639674 • Letter: W
Question
Write a C++ Program. Programs MUST compile and run. Also, do not forget proper documentation of your code. USE functions at all times for a modular program.
Write a class named Pool to represent a swimming pool. Start with writing a UML diagram and make sure to submit your UML diagram. In order to submit the UML
diagram, you can draw it in an application such as MS Word or PowerPoint, or draw it on paper and scan and attach the file. The class should have private instance fields 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 (in gallons per minute), and the volume of the pool (in cubic feet). Also provide the following functions:
Explanation / Answer
#include <iostream>
using namespace std;
void PoolSize(float Length, float Width, float Depth, float volume, const float cubicfeet=7.48051948);
void FillTime(float volume, float FillRate, float Minutes);
void main ()
{
float Length;
float Width;
float Depth;
float volume;
const float cubicfeet=7.48051948;
float FillRate;
float Minutes;
cout << "Insert the length: ";
cin >> Length;
cout << "Insert the width: ";
cin >> Width;
cout << "Insert the depth: ";
cin >> Depth;
PoolSize(Length, Width, Depth, volume, cubicfeet);
cout << "Insert the fill rate of the pool in gallons per minute: ";
cin >> FillRate;
cout << " ";
FillTime(volume, FillRate, Minutes);
system("pause");
}
//////////////////////////////////Fill Time///////////////////////////////////////////////
void FillTime(float gallons, float FillRate, float Minutes)
{
Minutes = gallons/FillRate;
cout <<"The time it takes to fill the pool with a fill rate of "<<FillRate<<" gallons per minute is: "<< Minutes <<" minutes ";
}
//////////////////////////////Volume & Capacity///////////////////////////////////////////
void PoolSize(float Length, float Width, float Depth, float Volume, const float cubicfeet)
{
float gallons;
Volume = (Length*Width*Depth);
cout << "The volume of the pool is: "<< Volume << " ";
gallons = (Volume*cubicfeet);
cout << "The capacity in gallons for this pool is: " <<gallons <<" ";
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.