Question: Please fix the problem inthis code. I get warning: # pragma once in main file. And fatal error , swimmingpool.h , No such file or

Please fix the problem inthis code. I get warning: # pragma once in main file. And fatal error , swimmingpool.h , No such file or directory

///SwimmingPool.h

#pragma once

class SwimmingPool

{

///Declare the instance variables

private:

double length, width, depth, rate_fill, rate_drain;

public:

SwimmingPool();

SwimmingPool(double length1, double width1, double depth1, double rate_fill1, double rate_drain1);

void water_needed_to_fill(double time);

void time_to_fill(double time);

void time_to_empty();

double add_for_specific_time(double time);

double drain_for_specific_time();

};

///SwimmingPool.cpp

#include

using namespace std;

SwimmingPool::SwimmingPool()

{

length = 0;

width = 0;

depth = 0;

rate_fill = 0;

rate_drain = 0;

}

SwimmingPool::SwimmingPool(double length1, double width1, double depth1, double rate_fill1, double rate_drain1)

{

length = length1;

width = width1;

depth = depth1;

rate_fill = rate_fill1;

rate_drain = rate_drain1;

}

void SwimmingPool::water_needed_to_fill(double time)

{

double amount;

//Calculate the capacity of pool

double capacity = length * width*depth*7.48052;

cout << " Total capacity of pool is: " << capacity << endl;

amount = add_for_specific_time(time);

cout << "Initially water present in the pool is: ";

if (capacity < amount)

cout << " Tank is already full.";

else

cout << " Amount of water needed to fill the remaining pool: " << (capacity - amount) << "gallons";

}

void SwimmingPool::time_to_fill(double time)

{

double amount;

amount = add_for_specific_time(time);

double capacity = length * width*depth*7.48052;

if (amount > capacity)

{

cout << " Time required to fill the pool is : 0 minutes";

}

else

{

double remain = capacity - amount;

cout << "Time required to fill the pool is: " << (remain / rate_fill) << "minutes.";

}

}

void SwimmingPool::time_to_empty()

{

double amount = length * width*depth*7.48052;

cout << "Time required to empty the pool is: " << (amount / rate_drain) << " minutes.";

}

double SwimmingPool::add_for_specific_time(double time)

{

return rate_fill * time;

}

double SwimmingPool::drain_for_specific_time()

{

double time;

cout << "Enter the time for which is draining from pool: ";

cin >> time;

return rate_drain * time;

}

///Main.cpp

#include using namespace std;

int main()

{

int choice;

double time_fill;

double length, width, depth, rate_fill, rate_drain;

cout << "Enter length of pool (in feet): ";

cin >> length;

cout << "Enter width of pool (in feet): ";

cin >> width;

cout << "Enter depth of pool (in feet): ";

cin >> depth;

cout << "Enter the rate at which water is filling: ";

cin >> rate_fill;

cout << "Enter the rate at which water is draining: ";

cin >> rate_drain;

cout << "Enter the time for which water is adding in the pool (Initially): ";

cin >> time_fill;

SwimmingPool sp(length, width, depth, rate_fill, rate_drain);

sp.water_needed_to_fill(time_fill);

cout << endl;

sp.time_to_empty();

cout << endl;

///to hold the output screen

system("pause");

return 0;

}

///output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!