Hi. I'm writing code that has to do with classes. I have it almost finished, but I'm getting a linking error. Here is the prompt:
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;
• add or drain water for a specific amount of time.
Note:
There are 7.48 GALLONS_IN_A_CUBIC_FEET. You’ll need this to estimate the
poolTotalWaterCapacity( ).
You should input Pool length, width, and depth (e.g., 30,15,10).
Based on these values, output “Total pool water capacity”.
Then, input …water fill in rate to completely fill the pool.
Based on all above values, output the “Time to fill the pool”.
--
Here are the three files for the code I set up:
-----
[main.cpp]
#include "swimmingPoolImp.cpp"
int main()
{
double length, width, depth, rateFill, rateDrain;
cout << "Please enter the length: " << endl;
cin >> length;
cout << "Please enter the width: " << endl;
cin >> width;
cout << "Please enter the depth: " << endl;
cin >> depth;
cout << "Please enter the rate in which water fills the pool: " << endl;
cin >> rateFill;
cout << "Please enter the rate in which water drains the pool: " << endl;
cin >> rateDrain;
> this is the error message I get:
>> clang: error: linker command failed with exit code 1 (use -v to see invocation)'
you leave out all the important part of the message
This is easy to fix.
You need to include in the main "swimmingPool.h" and not cpp.
in the swimmingPool.h u only need to add the class and the functions but not initialized.
In the swimmingpoolimt.cpp etc... you need to initialize the functions of. and also include swimming...h and iostream plus using namespace std;....