Can you help me with this problem please. Here is my code: #include  using namespace std; 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; }; int main() {     swimmingPool pool(20, 30, 10, 5, 2, 0);     cout << "Pool dimensions: " << pool.getLength() << "ft x " << pool.getWidth() << "ft x "               << pool.getDepth() << "ft" << endl;     cout << "Pool water flow in rate: " << pool.getWaterFlowRateIn() << " gallons per minute" << endl;     cout << "Pool water flow out rate: " << pool.getWaterFlowRateOut() << " gallons per minute" << endl;     cout << "Total water in pool: " << pool.getTotalWaterInPool() << " gallons" << endl;     std::cout << "Total water capacity: " << pool.poolTotalWaterCapacity() << " gallons" << endl;     pool.addWater(60, 10);     cout << "Water added. Total water in pool: " << pool.getTotalWaterInPool() << " gallons" << endl;     pool.drainWater(30, 4);     cout << "Water drained. Total water in pool: " << pool.getTotalWaterInPool() << " gallons" << endl;     int timeToFill = pool.timeToFillThePool();     if (timeToFill >= 0) {         cout << "Time to fill the pool completely: " << timeToFill << " minutes" << endl;     } else {         cout << "Invalid fill rate. Cannot determine time to fill the pool." << endl;     }     int timeToDrain = pool.timeToDrainThePool();     if (timeToDrain >= 0) {         cout << "Time to drain the pool completely: " << timeToDrain << " minutes" << endl;     } else {         cout << "Invalid drain rate. Cannot determine time to drain the pool." << endl;     }     double waterNeeded = pool.waterNeededToFillThePool();   cout << "Water needed to fill the pool: " << waterNeeded << " gallons" << endl;     return 0; }   And here is one of the few issues I am having /root/sandbox6f9a0586/nt-test-126872a3.cpp: In function 'int main(int, char**)': /root/sandbox6f9a0586/nt-test-126872a3.cpp:8:15: error: conflicting declaration of C function 'int main(int, char**)' int main(int argc, char **argv) { ^~~~ In file included from /root/sandbox6f9a0586/nt-test-126872a3.cpp:2:0: /root/sandbox6f9a0586/swimmingPoolImp.cpp:148:5: note: previous declaration 'int main()' int main() { ^~~~ make[2]: *** [CMakeFiles/runTests.dir/nt-test-126872a3.cpp.o] Error 1 make[1]: *** [CMakeFiles/runTests.dir/all] Error 2 make: *** [all] Error 2 I don't know what to do because my actual code works but not in this specific way.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 34SA
icon
Related questions
Question

Can you help me with this problem please. Here is my code:

#include <iostream>
using namespace std;
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;
};


int main() {
    swimmingPool pool(20, 30, 10, 5, 2, 0);


    cout << "Pool dimensions: " << pool.getLength() << "ft x " << pool.getWidth() << "ft x "
              << pool.getDepth() << "ft" << endl;
    cout << "Pool water flow in rate: " << pool.getWaterFlowRateIn() << " gallons per minute" << endl;
    cout << "Pool water flow out rate: " << pool.getWaterFlowRateOut() << " gallons per minute" << endl;
    cout << "Total water in pool: " << pool.getTotalWaterInPool() << " gallons" << endl;
    std::cout << "Total water capacity: " << pool.poolTotalWaterCapacity() << " gallons" << endl;


    pool.addWater(60, 10);
    cout << "Water added. Total water in pool: " << pool.getTotalWaterInPool() << " gallons" << endl;


    pool.drainWater(30, 4);
    cout << "Water drained. Total water in pool: " << pool.getTotalWaterInPool() << " gallons" << endl;


    int timeToFill = pool.timeToFillThePool();
    if (timeToFill >= 0) {
        cout << "Time to fill the pool completely: " << timeToFill << " minutes" << endl;
    } else {
        cout << "Invalid fill rate. Cannot determine time to fill the pool." << endl;
    }


    int timeToDrain = pool.timeToDrainThePool();
    if (timeToDrain >= 0) {
        cout << "Time to drain the pool completely: " << timeToDrain << " minutes" << endl;
    } else {
        cout << "Invalid drain rate. Cannot determine time to drain the pool." << endl;
    }


    double waterNeeded = pool.waterNeededToFillThePool();
  cout << "Water needed to fill the pool: " << waterNeeded << " gallons" << endl;


    return 0;
}
 
And here is one of the few issues I am having

/root/sandbox6f9a0586/nt-test-126872a3.cpp: In function 'int main(int, char**)': /root/sandbox6f9a0586/nt-test-126872a3.cpp:8:15: error: conflicting declaration of C function 'int main(int, char**)' int main(int argc, char **argv) { ^~~~ In file included from /root/sandbox6f9a0586/nt-test-126872a3.cpp:2:0: /root/sandbox6f9a0586/swimmingPoolImp.cpp:148:5: note: previous declaration 'int main()' int main() { ^~~~ make[2]: *** [CMakeFiles/runTests.dir/nt-test-126872a3.cpp.o] Error 1 make[1]: *** [CMakeFiles/runTests.dir/all] Error 2 make: *** [all] Error 2

I don't know what to do because my actual code works but not in this specific way.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning