riggnaros

swimmingpool_imp

Apr 21st, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.34 KB | None | 0 0
  1. //implementation file
  2.  
  3. #include <iostream>
  4. #include "swimming_pool_header.h"
  5.  
  6. using namespace std;
  7.  
  8. //constructor implementation
  9.  
  10. swimmingPool::swimmingPool(double l, double w, double d,
  11.     double fi, double fo, double wInPool) {
  12.     length = l;
  13.     width = w;
  14.     depth = d;
  15.     waterFlowInRate = fi;
  16.     waterFlowOutRate = fo;
  17.     amountOfWaterInPool = wInPool;
  18.  
  19. };
  20.  
  21. //set functions
  22.  
  23. void swimmingPool::set(double l, double w, double d,
  24.     double fi, double fo, double wInPool) {
  25.     length = l;
  26.     width = w;
  27.     depth = d;
  28.     waterFlowInRate = fi;
  29.     waterFlowOutRate = fo;
  30.     amountOfWaterInPool = wInPool;
  31. };
  32.  
  33. void swimmingPool::setLength(double l) {
  34.     length = l;
  35. };
  36.  
  37.  
  38. void swimmingPool::setWidth(double w) {
  39.     width = w;
  40. };
  41.  
  42.  
  43. void swimmingPool::setDepth(double d) {
  44.     depth = d;
  45. };
  46.  
  47.  
  48. void swimmingPool::setWaterFlowRateIn(double fi) {
  49.     waterFlowInRate = fi;
  50. };
  51.  
  52.  
  53. void swimmingPool::setWaterFlowRateOut(double fo) {
  54.     waterFlowOutRate = fo;
  55. };
  56.  
  57. void swimmingPool::setWaterInPool(double wInPool) {
  58.     amountOfWaterInPool = wInPool;
  59. };
  60.  
  61. //get functions
  62.  
  63. double swimmingPool::getLength() {
  64.     return length;
  65. };
  66.  
  67.  
  68. double swimmingPool::getWidth() {
  69.     return width;
  70. };
  71.  
  72.  
  73. double swimmingPool::getDepth() {
  74.     return depth;
  75. };
  76.  
  77.  
  78. double swimmingPool::getWaterFlowRateIn() {
  79.     return waterFlowInRate;
  80. };
  81.  
  82.  
  83. double swimmingPool::getWaterFlowRateOut() {
  84.     return waterFlowOutRate;
  85. };
  86.  
  87.  
  88. double swimmingPool::getTotalWaterInPool() {
  89.     return amountOfWaterInPool;
  90. };
  91.  
  92. //other functions
  93.  
  94. double swimmingPool::poolTotalWaterCapacity() {
  95.  
  96.     totalCapacityInPool = length * width * depth;
  97.     return totalCapacityInPool;
  98. };
  99.  
  100. int swimmingPool::timeToFillThePool() {
  101.     int time = 0;
  102.  
  103.     time = (waterNeeded / waterFlowInRate);
  104.    
  105.     return time;
  106. };
  107.  
  108.  
  109. int swimmingPool::timeToDrainThePool() {
  110.     int time = 0;
  111.  
  112.     time = (amountOfWaterInPool / waterFlowOutRate);
  113.  
  114.     return time;
  115. };
  116.  
  117.  
  118. double swimmingPool::waterNeededToFillThePool() {
  119.  
  120.     waterNeeded = (totalCapacityInPool - amountOfWaterInPool);
  121.     return waterNeeded;
  122. };
  123.  
  124. double swimmingPool::waterNeededToDrainThePool() {
  125.  
  126.     return amountOfWaterInPool;
  127. };
  128.  
  129.  
  130. void swimmingPool::addWater(int gallonsAdded) {
  131.  
  132.     amountOfWaterInPool = (amountOfWaterInPool + gallonsAdded);
  133. };
  134.  
  135.  
  136. void swimmingPool::drainWater(int gallonsDrained) {
  137.  
  138.     amountOfWaterInPool = (amountOfWaterInPool - gallonsDrained);
  139. };
Advertisement
Add Comment
Please, Sign In to add comment