Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //implementation file
- #include <iostream>
- #include "swimming_pool_header.h"
- using namespace std;
- //constructor implementation
- 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;
- };
- //set functions
- void swimmingPool::set(double l, double w, double d,
- double fi, double fo, double wInPool) {
- length = l;
- width = w;
- depth = d;
- waterFlowInRate = fi;
- waterFlowOutRate = fo;
- amountOfWaterInPool = wInPool;
- };
- void swimmingPool::setLength(double l) {
- length = l;
- };
- void swimmingPool::setWidth(double w) {
- width = w;
- };
- void swimmingPool::setDepth(double d) {
- depth = d;
- };
- void swimmingPool::setWaterFlowRateIn(double fi) {
- waterFlowInRate = fi;
- };
- void swimmingPool::setWaterFlowRateOut(double fo) {
- waterFlowOutRate = fo;
- };
- void swimmingPool::setWaterInPool(double wInPool) {
- amountOfWaterInPool = wInPool;
- };
- //get functions
- double swimmingPool::getLength() {
- return length;
- };
- double swimmingPool::getWidth() {
- return width;
- };
- double swimmingPool::getDepth() {
- return depth;
- };
- double swimmingPool::getWaterFlowRateIn() {
- return waterFlowInRate;
- };
- double swimmingPool::getWaterFlowRateOut() {
- return waterFlowOutRate;
- };
- double swimmingPool::getTotalWaterInPool() {
- return amountOfWaterInPool;
- };
- //other functions
- double swimmingPool::poolTotalWaterCapacity() {
- totalCapacityInPool = length * width * depth;
- return totalCapacityInPool;
- };
- int swimmingPool::timeToFillThePool() {
- int time = 0;
- time = (waterNeeded / waterFlowInRate);
- return time;
- };
- int swimmingPool::timeToDrainThePool() {
- int time = 0;
- time = (amountOfWaterInPool / waterFlowOutRate);
- return time;
- };
- double swimmingPool::waterNeededToFillThePool() {
- waterNeeded = (totalCapacityInPool - amountOfWaterInPool);
- return waterNeeded;
- };
- double swimmingPool::waterNeededToDrainThePool() {
- return amountOfWaterInPool;
- };
- void swimmingPool::addWater(int gallonsAdded) {
- amountOfWaterInPool = (amountOfWaterInPool + gallonsAdded);
- };
- void swimmingPool::drainWater(int gallonsDrained) {
- amountOfWaterInPool = (amountOfWaterInPool - gallonsDrained);
- };
Advertisement
Add Comment
Please, Sign In to add comment