SlideShare a Scribd company logo
main.cpp
#include
#include
#include "SwimmingPool.h"
using namespace std;
void printMainMenu();
void printPoolVolume();
void printGetPoolDimensions(bool);
void printHasDimensions();
void checkDimensions();
void printError();
void printPoolDimensions();
double editValue(double);
void printGetFillRate();
void printGetDrainRate();
void printAddWater();
void printDrainRate();
void printFillRate();
char printWantwer();
SwimmingPool pool;
int _response;
int _numResponses;
double _length;
double _width;
double _depth;
//double _currentwerVolume;
double _drainRate;
double _fillRate;
bool _end;
char _newValue[5];
int main()
{
int fillTime;
int drainTime;
double drained;
// Set output style and precision
cout << fixed << showpoint << setprecision(2);
// Main program loop
// ends when _end==true
while (!_end)
{
// Prints main option list
printMainMenu();
// Switch based on response
switch (_response)
{
// Sets pool dimensions
case 1:
if (pool.hasDimensions())
printHasDimensions();
else
{
printPoolDimensions();
printPoolVolume();
}
break;
// Prints pool dimensions
case 2:
printGetPoolDimensions(false);
system("pause");
break;
// Prints fill rate
case 3:
printGetFillRate();
break;
// Prints drain rate
case 4:
printGetDrainRate();
break;
// Determine water need to fill pool to capacity
case 5:
checkDimensions();
if (!pool.hasWater())
cout << " The pool is currently empty";
else
{
cout << " The pool currently has "
<< pool.getwerVolume()
<< " units"
<< endl;
}
cout << "  Water needed: "
<< pool.getFillAmount(pool.getwerVolume())
<< " units of water  ";
system("pause");
break;
// Determine time required to fill pool at rate
case 6:
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
if (pool.getFillRate() <= 0)
printGetFillRate();
cout << " Time to fill pool: "
<< pool.getFillTime()
<< endl
<< endl;
system("pause");
break;
// Determine time required to drain pool at rate
case 7:
checkDimensions();
if (_drainRate <= 0)
printGetDrainRate();
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
}
if (response == 'y')
printAddWater();
else
break;;
}
cout << " Time to drain pool: "
<< pool.getDrainTime()
<< endl
<< endl;
system("pause");
break;
case 8:
checkDimensions();
if (pool.getFillRate() <= 0)
printGetFillRate();
else
printFillRate();
cout << " Enter fill time: ";
cin >> fillTime;
pool.setFillTime(fillTime);
pool.setwerVolume(pool.getwerVolume() + pool.fill());
cout << endl
<< pool.fill()
<< " units of water were added to the pool  "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water  ";
system("pause");
break;
case 9:
checkDimensions();
if (pool.getDrainRate() <= 0)
printGetDrainRate();
else
printDrainRate();
cout << " Enter drain time: ";
cin >> drainTime;
pool.setDrainTime(drainTime);
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
cout << "  Response is "
<< response;
}
if (response == 'y')
printAddWater();
else
break;
}
drained = pool.drain();
cout << endl
<< " "
<< drained
<< " units of water were removed from the pool  "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water  ";
system("pause");
break;
case 10:
_end = true;
break;
default:
printError();
break;
}
}
return EXIT_SUCCESS;
}
void printMainMenu()
{
_numResponses = 6;
cout << " Type the number cooresponding to the task you would like to complete:   "
<< " 1) Set pool dimensions "
<< " 2) Print pool dimensions "
<< " 3) Set fill rate "
<< " 4) Set drain rate "
<< " Print fill and drain rates "
<< " Add water to pool "
<< " Remove water from pool "
<< " 5) Determine water needed to fill pool to capacity  "
<< " Determine time required to:  "
<< " 6) fill pool "
<< " 7) drain pool  "
<< " For a specific amount of time:  "
<< " 8) fill pool "
<< " 9) drain pool "
<< " 10) Exit Program  "
<< " Choice: ";
cin >> _response;
}
void printPoolVolume()
{
cout << " Pool volume is "
<< pool.getVolume()
<< endl
<< endl;
}
void printGetPoolDimensions(bool edit)
{
cout << " Enter pool dimensions:"
<< endl
<< " Length: ";
if (edit)
editValue(_length);
cin >> _length;
pool.setLength(_length);
cout << " Width: ";
if (edit)
editValue(_width);
cin >> _width;
pool.setWidth(_width);
cout << " Depth: ";
if (edit)
editValue(_depth);
cin >> _depth;
pool.setDepth(_depth);
printPoolVolume();
}
double editValue(double value)
{
cout << value;
cin.seekg(0, cin.beg);
cin.getline(_newValue, 5);
return atof(_newValue);
}
void printHasDimensions()
{
_numResponses = 2;
cout << " The pool already has dimensions"
<< endl
<< endl
<< "1) Create new dimensions"
//<< endl
//<< "2) Edit current dimensions"
<< endl
<< "2) Return to main menu"
<< endl
<< "Response: ";
cin >> _response;
switch (_response)
{
case 1:
printGetPoolDimensions(false);
break;
//case 2:
// // Print pool dimensions prompt with existing values
// printGetPoolDimensions(true);
// break;
case 2:
printMainMenu();
break;
default:
printError();
printHasDimensions();
break;
}
}
// Function that prints an error when invalid option entered at menu
void printError()
{
cout << "a" // make an error sound
// print error
<< " You entered an invalid response, please try again"
<< endl
<< endl;
}
void printPoolDimensions()
{
cout << "  Pool Dimensions  "
<< " Length: "
<< _length
<< endl
<< " Width: "
<< _width
<< endl
<< " Depth: "
<< _depth
<< endl
<< endl;
printPoolVolume();
}
void checkDimensions()
{
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
}
void printGetFillRate()
{
cout << " Enter the fill rate: ";
cin >> _fillRate;
pool.setFillRate(_fillRate);
}
void printGetDrainRate()
{
cout << " Enter the drain rate: ";
cin >> _drainRate;
pool.setDrainRate(_drainRate);
}
void printAddWater()
{
double currentwerVolume;
cout << " How much water would you like to add?  "
<< " Response: ";
cin >> currentwerVolume;
if (currentwerVolume > pool.getVolume())
{
currentwerVolume = pool.getVolume();
cout << " You entered more than the pool could hold ("
<< pool.getVolume()
<< ") but I fixed that for you. ";
}
pool.setwerVolume(currentwerVolume);
}
void printDrainRate()
{
cout << " Drain rate is currently: "
<< pool.getDrainRate()
<< endl
<< endl;
}
void printFillRate()
{
cout << " Fill rate is currently: "
<< pool.getFillRate()
<< endl
<< endl;
}
char printWantwer()
{
char response;
cout << " The pool has no water to drain! "
<< " Would you like to add water?"
<< endl
<< endl
<< " Response: ";
cin >> response;
return response;
}
SwimmingPool.h
#pragma once
class SwimmingPool
{
public:
SwimmingPool();
SwimmingPool(double, double, double);
SwimmingPool(double, double, double, double, double);
void setLength(double);
void setWidth(double);
void setDepth(double);
void setDrainRate(double);
double getDrainRate();
void setFillRate(double);
double getFillRate();
void setFillTime(int);
void setDrainTime(int);
void setwerVolume(double);
double getVolume();
double getwerVolume();
double getFillAmount(double);
int getDrainTime();
int getFillTime();
double drain();
double fill();
double fill(int);
bool hasDimensions();
bool hasWater();
private:
double _length;
double _width;
double _depth;
double _fillRate;
double _drainRate;
int _fillTime;
int _drainTime;
double _volume;
double _waterVolume;
};
SwimmingPool.cpp
#include "SwimmingPool.h"
using namespace std;
// Default constructor
SwimmingPool::SwimmingPool()
{
_length = 0;
_width = 0;
_depth = 0;
}
// Basic constructor defined with member initialization
SwimmingPool::SwimmingPool (double l, double w, double d) :_length(l), _width(w),
_depth(d)
{
// Assign to the instance variables the arguments passed to constructo
_volume = _length * _width * _depth;
}
// Full Constructor
SwimmingPool::SwimmingPool(double length, double width, double depth, double fillRate,
double drainRate)
{
// Assign to the instance variables the arguments passed to constructor
_length = length;
_width = width;
_depth = depth;
_fillRate = fillRate;
_drainRate = drainRate;
_volume = getVolume();
// Get the volume
}
void SwimmingPool::setLength(double l)
{
_length = l;
}
void SwimmingPool::setWidth(double w)
{
_width = w;
}
void SwimmingPool::setDepth(double d)
{
_depth = d;
}
void SwimmingPool::setDrainRate(double r)
{
_drainRate = r;
}
double SwimmingPool::getDrainRate()
{
return _drainRate;
}
void SwimmingPool::setFillRate(double r)
{
_fillRate = r;
}
double SwimmingPool::getFillRate()
{
return _fillRate;
}
void SwimmingPool::setFillTime(int t)
{
_fillTime = t;
}
void SwimmingPool::setDrainTime(int t)
{
_drainTime = t;
}
// Member function to calculate volume
double SwimmingPool::getVolume()
{
// No need to check values of instance variables
// Return the volume
return _length * _width * _depth;
}
void SwimmingPool::setwerVolume(double v)
{
_waterVolume = v;
}
double SwimmingPool::getwerVolume()
{
return _waterVolume;
}
// Returns amount of water needed to fill an empty or partially filled pool
double SwimmingPool::getFillAmount(double currentwerVolume)
{
return getVolume() - currentwerVolume;
}
// Returns time needed to completely or partially drain the pool
int SwimmingPool::getDrainTime()
{
return (int)(_waterVolume/_drainRate);
}
// Returns the time need to completely or partially drain the pool
int SwimmingPool::getFillTime()
{
return (int)(getVolume()/_fillRate);
}
// Drain the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::drain()
{
double waterDrained = _drainRate * _drainTime;
_waterVolume -= waterDrained;
if (_waterVolume < 0)
_waterVolume = 0;
return waterDrained;
}
double SwimmingPool::fill()
{
_waterVolume += _fillRate * _fillTime;
return _waterVolume;
}
// Fill the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::fill(int time)
{
return 0;
}
bool SwimmingPool::hasDimensions()
{
if (_length > 0 && _width > 0 && _depth > 0)
return true;
else
return false;
}
bool SwimmingPool::hasWater()
{
if (_waterVolume > 0)
return true;
else
return false;
}
Solution
main.cpp
#include
#include
#include "SwimmingPool.h"
using namespace std;
void printMainMenu();
void printPoolVolume();
void printGetPoolDimensions(bool);
void printHasDimensions();
void checkDimensions();
void printError();
void printPoolDimensions();
double editValue(double);
void printGetFillRate();
void printGetDrainRate();
void printAddWater();
void printDrainRate();
void printFillRate();
char printWantwer();
SwimmingPool pool;
int _response;
int _numResponses;
double _length;
double _width;
double _depth;
//double _currentwerVolume;
double _drainRate;
double _fillRate;
bool _end;
char _newValue[5];
int main()
{
int fillTime;
int drainTime;
double drained;
// Set output style and precision
cout << fixed << showpoint << setprecision(2);
// Main program loop
// ends when _end==true
while (!_end)
{
// Prints main option list
printMainMenu();
// Switch based on response
switch (_response)
{
// Sets pool dimensions
case 1:
if (pool.hasDimensions())
printHasDimensions();
else
{
printPoolDimensions();
printPoolVolume();
}
break;
// Prints pool dimensions
case 2:
printGetPoolDimensions(false);
system("pause");
break;
// Prints fill rate
case 3:
printGetFillRate();
break;
// Prints drain rate
case 4:
printGetDrainRate();
break;
// Determine water need to fill pool to capacity
case 5:
checkDimensions();
if (!pool.hasWater())
cout << " The pool is currently empty";
else
{
cout << " The pool currently has "
<< pool.getwerVolume()
<< " units"
<< endl;
}
cout << "  Water needed: "
<< pool.getFillAmount(pool.getwerVolume())
<< " units of water  ";
system("pause");
break;
// Determine time required to fill pool at rate
case 6:
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
if (pool.getFillRate() <= 0)
printGetFillRate();
cout << " Time to fill pool: "
<< pool.getFillTime()
<< endl
<< endl;
system("pause");
break;
// Determine time required to drain pool at rate
case 7:
checkDimensions();
if (_drainRate <= 0)
printGetDrainRate();
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
}
if (response == 'y')
printAddWater();
else
break;;
}
cout << " Time to drain pool: "
<< pool.getDrainTime()
<< endl
<< endl;
system("pause");
break;
case 8:
checkDimensions();
if (pool.getFillRate() <= 0)
printGetFillRate();
else
printFillRate();
cout << " Enter fill time: ";
cin >> fillTime;
pool.setFillTime(fillTime);
pool.setwerVolume(pool.getwerVolume() + pool.fill());
cout << endl
<< pool.fill()
<< " units of water were added to the pool  "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water  ";
system("pause");
break;
case 9:
checkDimensions();
if (pool.getDrainRate() <= 0)
printGetDrainRate();
else
printDrainRate();
cout << " Enter drain time: ";
cin >> drainTime;
pool.setDrainTime(drainTime);
if (!pool.hasWater())
{
char response = printWantwer();
while (response != 'y' && response != 'n')
{
printError();
response = printWantwer();
cout << "  Response is "
<< response;
}
if (response == 'y')
printAddWater();
else
break;
}
drained = pool.drain();
cout << endl
<< " "
<< drained
<< " units of water were removed from the pool  "
<< " The pool now contains "
<< pool.getwerVolume()
<< " units of water  ";
system("pause");
break;
case 10:
_end = true;
break;
default:
printError();
break;
}
}
return EXIT_SUCCESS;
}
void printMainMenu()
{
_numResponses = 6;
cout << " Type the number cooresponding to the task you would like to complete:   "
<< " 1) Set pool dimensions "
<< " 2) Print pool dimensions "
<< " 3) Set fill rate "
<< " 4) Set drain rate "
<< " Print fill and drain rates "
<< " Add water to pool "
<< " Remove water from pool "
<< " 5) Determine water needed to fill pool to capacity  "
<< " Determine time required to:  "
<< " 6) fill pool "
<< " 7) drain pool  "
<< " For a specific amount of time:  "
<< " 8) fill pool "
<< " 9) drain pool "
<< " 10) Exit Program  "
<< " Choice: ";
cin >> _response;
}
void printPoolVolume()
{
cout << " Pool volume is "
<< pool.getVolume()
<< endl
<< endl;
}
void printGetPoolDimensions(bool edit)
{
cout << " Enter pool dimensions:"
<< endl
<< " Length: ";
if (edit)
editValue(_length);
cin >> _length;
pool.setLength(_length);
cout << " Width: ";
if (edit)
editValue(_width);
cin >> _width;
pool.setWidth(_width);
cout << " Depth: ";
if (edit)
editValue(_depth);
cin >> _depth;
pool.setDepth(_depth);
printPoolVolume();
}
double editValue(double value)
{
cout << value;
cin.seekg(0, cin.beg);
cin.getline(_newValue, 5);
return atof(_newValue);
}
void printHasDimensions()
{
_numResponses = 2;
cout << " The pool already has dimensions"
<< endl
<< endl
<< "1) Create new dimensions"
//<< endl
//<< "2) Edit current dimensions"
<< endl
<< "2) Return to main menu"
<< endl
<< "Response: ";
cin >> _response;
switch (_response)
{
case 1:
printGetPoolDimensions(false);
break;
//case 2:
// // Print pool dimensions prompt with existing values
// printGetPoolDimensions(true);
// break;
case 2:
printMainMenu();
break;
default:
printError();
printHasDimensions();
break;
}
}
// Function that prints an error when invalid option entered at menu
void printError()
{
cout << "a" // make an error sound
// print error
<< " You entered an invalid response, please try again"
<< endl
<< endl;
}
void printPoolDimensions()
{
cout << "  Pool Dimensions  "
<< " Length: "
<< _length
<< endl
<< " Width: "
<< _width
<< endl
<< " Depth: "
<< _depth
<< endl
<< endl;
printPoolVolume();
}
void checkDimensions()
{
if (!pool.hasDimensions())
{
cout << " Pool dimensions not yet entered. ";
printGetPoolDimensions(false);
}
}
void printGetFillRate()
{
cout << " Enter the fill rate: ";
cin >> _fillRate;
pool.setFillRate(_fillRate);
}
void printGetDrainRate()
{
cout << " Enter the drain rate: ";
cin >> _drainRate;
pool.setDrainRate(_drainRate);
}
void printAddWater()
{
double currentwerVolume;
cout << " How much water would you like to add?  "
<< " Response: ";
cin >> currentwerVolume;
if (currentwerVolume > pool.getVolume())
{
currentwerVolume = pool.getVolume();
cout << " You entered more than the pool could hold ("
<< pool.getVolume()
<< ") but I fixed that for you. ";
}
pool.setwerVolume(currentwerVolume);
}
void printDrainRate()
{
cout << " Drain rate is currently: "
<< pool.getDrainRate()
<< endl
<< endl;
}
void printFillRate()
{
cout << " Fill rate is currently: "
<< pool.getFillRate()
<< endl
<< endl;
}
char printWantwer()
{
char response;
cout << " The pool has no water to drain! "
<< " Would you like to add water?"
<< endl
<< endl
<< " Response: ";
cin >> response;
return response;
}
SwimmingPool.h
#pragma once
class SwimmingPool
{
public:
SwimmingPool();
SwimmingPool(double, double, double);
SwimmingPool(double, double, double, double, double);
void setLength(double);
void setWidth(double);
void setDepth(double);
void setDrainRate(double);
double getDrainRate();
void setFillRate(double);
double getFillRate();
void setFillTime(int);
void setDrainTime(int);
void setwerVolume(double);
double getVolume();
double getwerVolume();
double getFillAmount(double);
int getDrainTime();
int getFillTime();
double drain();
double fill();
double fill(int);
bool hasDimensions();
bool hasWater();
private:
double _length;
double _width;
double _depth;
double _fillRate;
double _drainRate;
int _fillTime;
int _drainTime;
double _volume;
double _waterVolume;
};
SwimmingPool.cpp
#include "SwimmingPool.h"
using namespace std;
// Default constructor
SwimmingPool::SwimmingPool()
{
_length = 0;
_width = 0;
_depth = 0;
}
// Basic constructor defined with member initialization
SwimmingPool::SwimmingPool (double l, double w, double d) :_length(l), _width(w),
_depth(d)
{
// Assign to the instance variables the arguments passed to constructo
_volume = _length * _width * _depth;
}
// Full Constructor
SwimmingPool::SwimmingPool(double length, double width, double depth, double fillRate,
double drainRate)
{
// Assign to the instance variables the arguments passed to constructor
_length = length;
_width = width;
_depth = depth;
_fillRate = fillRate;
_drainRate = drainRate;
_volume = getVolume();
// Get the volume
}
void SwimmingPool::setLength(double l)
{
_length = l;
}
void SwimmingPool::setWidth(double w)
{
_width = w;
}
void SwimmingPool::setDepth(double d)
{
_depth = d;
}
void SwimmingPool::setDrainRate(double r)
{
_drainRate = r;
}
double SwimmingPool::getDrainRate()
{
return _drainRate;
}
void SwimmingPool::setFillRate(double r)
{
_fillRate = r;
}
double SwimmingPool::getFillRate()
{
return _fillRate;
}
void SwimmingPool::setFillTime(int t)
{
_fillTime = t;
}
void SwimmingPool::setDrainTime(int t)
{
_drainTime = t;
}
// Member function to calculate volume
double SwimmingPool::getVolume()
{
// No need to check values of instance variables
// Return the volume
return _length * _width * _depth;
}
void SwimmingPool::setwerVolume(double v)
{
_waterVolume = v;
}
double SwimmingPool::getwerVolume()
{
return _waterVolume;
}
// Returns amount of water needed to fill an empty or partially filled pool
double SwimmingPool::getFillAmount(double currentwerVolume)
{
return getVolume() - currentwerVolume;
}
// Returns time needed to completely or partially drain the pool
int SwimmingPool::getDrainTime()
{
return (int)(_waterVolume/_drainRate);
}
// Returns the time need to completely or partially drain the pool
int SwimmingPool::getFillTime()
{
return (int)(getVolume()/_fillRate);
}
// Drain the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::drain()
{
double waterDrained = _drainRate * _drainTime;
_waterVolume -= waterDrained;
if (_waterVolume < 0)
_waterVolume = 0;
return waterDrained;
}
double SwimmingPool::fill()
{
_waterVolume += _fillRate * _fillTime;
return _waterVolume;
}
// Fill the pool for a specified time period
// Returns adjusted water volume
double SwimmingPool::fill(int time)
{
return 0;
}
bool SwimmingPool::hasDimensions()
{
if (_length > 0 && _width > 0 && _depth > 0)
return true;
else
return false;
}
bool SwimmingPool::hasWater()
{
if (_waterVolume > 0)
return true;
else
return false;
}

More Related Content

Similar to main.cpp #include iostream #include iomanip #include S.pdf

4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
MomenMostafa
 
Final requirement in programming niperos
Final requirement in programming   niperosFinal requirement in programming   niperos
Final requirement in programming niperosmarkings17
 
Memory Manglement in Raku
Memory Manglement in RakuMemory Manglement in Raku
Memory Manglement in Raku
Workhorse Computing
 
verilog code
verilog codeverilog code
verilog code
Mantra VLSI
 
Final requirement (2)
Final requirement (2)Final requirement (2)
Final requirement (2)Anjie Sengoku
 
Powerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prgPowerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prgalyssa-castro2326
 
Php 5.6
Php 5.6Php 5.6
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
Visual Engineering
 
7 functions
7  functions7  functions
7 functions
MomenMostafa
 
Start with the inclusion of libraries#include iostream .docx
 Start with the inclusion of libraries#include iostream .docx Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
MARRY7
 
Travel management
Travel managementTravel management
Travel management1Parimal2
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
Francesco Casalegno
 
Hi,Please fidn the Answer.Sorting,h is Header .pdf
Hi,Please fidn the Answer.Sorting,h is Header .pdfHi,Please fidn the Answer.Sorting,h is Header .pdf
Hi,Please fidn the Answer.Sorting,h is Header .pdf
anandf0099
 
Form1.Cs
Form1.CsForm1.Cs
Form1.Cs
kwilke859
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
kavithaarp
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
Rodrigo Almeida
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
Farhan Ab Rahman
 
Bangun datar dan bangun ruang
Bangun datar dan bangun ruangBangun datar dan bangun ruang
Bangun datar dan bangun ruang
SanSan Yagyoo
 

Similar to main.cpp #include iostream #include iomanip #include S.pdf (20)

Tu1
Tu1Tu1
Tu1
 
4 operators, expressions &amp; statements
4  operators, expressions &amp; statements4  operators, expressions &amp; statements
4 operators, expressions &amp; statements
 
Final requirement in programming niperos
Final requirement in programming   niperosFinal requirement in programming   niperos
Final requirement in programming niperos
 
Macaraeg
MacaraegMacaraeg
Macaraeg
 
Memory Manglement in Raku
Memory Manglement in RakuMemory Manglement in Raku
Memory Manglement in Raku
 
verilog code
verilog codeverilog code
verilog code
 
Final requirement (2)
Final requirement (2)Final requirement (2)
Final requirement (2)
 
Powerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prgPowerpoint presentation final requirement in fnd prg
Powerpoint presentation final requirement in fnd prg
 
Php 5.6
Php 5.6Php 5.6
Php 5.6
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
 
7 functions
7  functions7  functions
7 functions
 
Start with the inclusion of libraries#include iostream .docx
 Start with the inclusion of libraries#include iostream .docx Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
 
Travel management
Travel managementTravel management
Travel management
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
 
Hi,Please fidn the Answer.Sorting,h is Header .pdf
Hi,Please fidn the Answer.Sorting,h is Header .pdfHi,Please fidn the Answer.Sorting,h is Header .pdf
Hi,Please fidn the Answer.Sorting,h is Header .pdf
 
Form1.Cs
Form1.CsForm1.Cs
Form1.Cs
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
 
Microkernel Development
Microkernel DevelopmentMicrokernel Development
Microkernel Development
 
C++ TUTORIAL 1
C++ TUTORIAL 1C++ TUTORIAL 1
C++ TUTORIAL 1
 
Bangun datar dan bangun ruang
Bangun datar dan bangun ruangBangun datar dan bangun ruang
Bangun datar dan bangun ruang
 

More from arasanlethers

#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf
#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf
#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf
arasanlethers
 
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdf
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdfC, D, and E are wrong and involve random constants. Thisnarrows it d.pdf
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdf
arasanlethers
 
AnswerOogenesis is the process by which ovum mother cells or oogo.pdf
AnswerOogenesis is the process by which ovum mother cells or oogo.pdfAnswerOogenesis is the process by which ovum mother cells or oogo.pdf
AnswerOogenesis is the process by which ovum mother cells or oogo.pdf
arasanlethers
 
AnswerB) S. typhimuium gains access to the host by crossing the.pdf
AnswerB) S. typhimuium gains access to the host by crossing the.pdfAnswerB) S. typhimuium gains access to the host by crossing the.pdf
AnswerB) S. typhimuium gains access to the host by crossing the.pdf
arasanlethers
 
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdf
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdfAnswer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdf
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdf
arasanlethers
 
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdf
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdfA Letter to myself!Hi to myself!Now that I am an Engineer with a.pdf
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdf
arasanlethers
 
Particulars Amount ($) Millons a) Purchase consideratio.pdf
     Particulars  Amount ($) Millons          a) Purchase consideratio.pdf     Particulars  Amount ($) Millons          a) Purchase consideratio.pdf
Particulars Amount ($) Millons a) Purchase consideratio.pdf
arasanlethers
 
2 = 14.191,     df = 9,2df = 1.58 ,         P(2 14.191) = .pdf
2 = 14.191,     df = 9,2df = 1.58 ,         P(2  14.191) = .pdf2 = 14.191,     df = 9,2df = 1.58 ,         P(2  14.191) = .pdf
2 = 14.191,     df = 9,2df = 1.58 ,         P(2 14.191) = .pdf
arasanlethers
 
while determining the pH the pH of the water is n.pdf
                     while determining the pH the pH of the water is n.pdf                     while determining the pH the pH of the water is n.pdf
while determining the pH the pH of the water is n.pdf
arasanlethers
 
Quantum Numbers and Atomic Orbitals By solving t.pdf
                     Quantum Numbers and Atomic Orbitals  By solving t.pdf                     Quantum Numbers and Atomic Orbitals  By solving t.pdf
Quantum Numbers and Atomic Orbitals By solving t.pdf
arasanlethers
 
They are molecules that are mirror images of each.pdf
                     They are molecules that are mirror images of each.pdf                     They are molecules that are mirror images of each.pdf
They are molecules that are mirror images of each.pdf
arasanlethers
 
Well u put so many type of compounds here.Generally speakingi) t.pdf
Well u put so many type of compounds here.Generally speakingi) t.pdfWell u put so many type of compounds here.Generally speakingi) t.pdf
Well u put so many type of compounds here.Generally speakingi) t.pdf
arasanlethers
 
Ventilation is the process of air going in and out of lungs. Increas.pdf
Ventilation is the process of air going in and out of lungs. Increas.pdfVentilation is the process of air going in and out of lungs. Increas.pdf
Ventilation is the process of air going in and out of lungs. Increas.pdf
arasanlethers
 
A1) A living being or an individual is known as an organism and it i.pdf
A1) A living being or an individual is known as an organism and it i.pdfA1) A living being or an individual is known as an organism and it i.pdf
A1) A living being or an individual is known as an organism and it i.pdf
arasanlethers
 
there are laws and regulations that would pertain to an online breac.pdf
there are laws and regulations that would pertain to an online breac.pdfthere are laws and regulations that would pertain to an online breac.pdf
there are laws and regulations that would pertain to an online breac.pdf
arasanlethers
 
The false statement among the given list is “Territoriality means ho.pdf
The false statement among the given list is “Territoriality means ho.pdfThe false statement among the given list is “Territoriality means ho.pdf
The false statement among the given list is “Territoriality means ho.pdf
arasanlethers
 
The current article is discussing about the role of SOX4 geneprotei.pdf
The current article is discussing about the role of SOX4 geneprotei.pdfThe current article is discussing about the role of SOX4 geneprotei.pdf
The current article is discussing about the role of SOX4 geneprotei.pdf
arasanlethers
 
The major similarities between rocks and minerals are as follows1.pdf
The major similarities between rocks and minerals are as follows1.pdfThe major similarities between rocks and minerals are as follows1.pdf
The major similarities between rocks and minerals are as follows1.pdf
arasanlethers
 
Pipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdfPipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdf
arasanlethers
 
12). Choose the letter designation that represent homozygous recessi.pdf
12). Choose the letter designation that represent homozygous recessi.pdf12). Choose the letter designation that represent homozygous recessi.pdf
12). Choose the letter designation that represent homozygous recessi.pdf
arasanlethers
 

More from arasanlethers (20)

#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf
#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf
#include SDLSDL.hSDL_Surface Background = NULL; SDL_Surface.pdf
 
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdf
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdfC, D, and E are wrong and involve random constants. Thisnarrows it d.pdf
C, D, and E are wrong and involve random constants. Thisnarrows it d.pdf
 
AnswerOogenesis is the process by which ovum mother cells or oogo.pdf
AnswerOogenesis is the process by which ovum mother cells or oogo.pdfAnswerOogenesis is the process by which ovum mother cells or oogo.pdf
AnswerOogenesis is the process by which ovum mother cells or oogo.pdf
 
AnswerB) S. typhimuium gains access to the host by crossing the.pdf
AnswerB) S. typhimuium gains access to the host by crossing the.pdfAnswerB) S. typhimuium gains access to the host by crossing the.pdf
AnswerB) S. typhimuium gains access to the host by crossing the.pdf
 
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdf
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdfAnswer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdf
Answer question1,2,4,5Ion–dipole interactionsAffinity of oxygen .pdf
 
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdf
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdfA Letter to myself!Hi to myself!Now that I am an Engineer with a.pdf
A Letter to myself!Hi to myself!Now that I am an Engineer with a.pdf
 
Particulars Amount ($) Millons a) Purchase consideratio.pdf
     Particulars  Amount ($) Millons          a) Purchase consideratio.pdf     Particulars  Amount ($) Millons          a) Purchase consideratio.pdf
Particulars Amount ($) Millons a) Purchase consideratio.pdf
 
2 = 14.191,     df = 9,2df = 1.58 ,         P(2 14.191) = .pdf
2 = 14.191,     df = 9,2df = 1.58 ,         P(2  14.191) = .pdf2 = 14.191,     df = 9,2df = 1.58 ,         P(2  14.191) = .pdf
2 = 14.191,     df = 9,2df = 1.58 ,         P(2 14.191) = .pdf
 
while determining the pH the pH of the water is n.pdf
                     while determining the pH the pH of the water is n.pdf                     while determining the pH the pH of the water is n.pdf
while determining the pH the pH of the water is n.pdf
 
Quantum Numbers and Atomic Orbitals By solving t.pdf
                     Quantum Numbers and Atomic Orbitals  By solving t.pdf                     Quantum Numbers and Atomic Orbitals  By solving t.pdf
Quantum Numbers and Atomic Orbitals By solving t.pdf
 
They are molecules that are mirror images of each.pdf
                     They are molecules that are mirror images of each.pdf                     They are molecules that are mirror images of each.pdf
They are molecules that are mirror images of each.pdf
 
Well u put so many type of compounds here.Generally speakingi) t.pdf
Well u put so many type of compounds here.Generally speakingi) t.pdfWell u put so many type of compounds here.Generally speakingi) t.pdf
Well u put so many type of compounds here.Generally speakingi) t.pdf
 
Ventilation is the process of air going in and out of lungs. Increas.pdf
Ventilation is the process of air going in and out of lungs. Increas.pdfVentilation is the process of air going in and out of lungs. Increas.pdf
Ventilation is the process of air going in and out of lungs. Increas.pdf
 
A1) A living being or an individual is known as an organism and it i.pdf
A1) A living being or an individual is known as an organism and it i.pdfA1) A living being or an individual is known as an organism and it i.pdf
A1) A living being or an individual is known as an organism and it i.pdf
 
there are laws and regulations that would pertain to an online breac.pdf
there are laws and regulations that would pertain to an online breac.pdfthere are laws and regulations that would pertain to an online breac.pdf
there are laws and regulations that would pertain to an online breac.pdf
 
The false statement among the given list is “Territoriality means ho.pdf
The false statement among the given list is “Territoriality means ho.pdfThe false statement among the given list is “Territoriality means ho.pdf
The false statement among the given list is “Territoriality means ho.pdf
 
The current article is discussing about the role of SOX4 geneprotei.pdf
The current article is discussing about the role of SOX4 geneprotei.pdfThe current article is discussing about the role of SOX4 geneprotei.pdf
The current article is discussing about the role of SOX4 geneprotei.pdf
 
The major similarities between rocks and minerals are as follows1.pdf
The major similarities between rocks and minerals are as follows1.pdfThe major similarities between rocks and minerals are as follows1.pdf
The major similarities between rocks and minerals are as follows1.pdf
 
Pipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdfPipelining understandingPipelining is running multiple stages of .pdf
Pipelining understandingPipelining is running multiple stages of .pdf
 
12). Choose the letter designation that represent homozygous recessi.pdf
12). Choose the letter designation that represent homozygous recessi.pdf12). Choose the letter designation that represent homozygous recessi.pdf
12). Choose the letter designation that represent homozygous recessi.pdf
 

Recently uploaded

MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 

Recently uploaded (20)

MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 

main.cpp #include iostream #include iomanip #include S.pdf

  • 1. main.cpp #include #include #include "SwimmingPool.h" using namespace std; void printMainMenu(); void printPoolVolume(); void printGetPoolDimensions(bool); void printHasDimensions(); void checkDimensions(); void printError(); void printPoolDimensions(); double editValue(double); void printGetFillRate(); void printGetDrainRate(); void printAddWater(); void printDrainRate(); void printFillRate(); char printWantwer(); SwimmingPool pool; int _response; int _numResponses; double _length; double _width; double _depth; //double _currentwerVolume; double _drainRate; double _fillRate; bool _end; char _newValue[5]; int main() { int fillTime;
  • 2. int drainTime; double drained; // Set output style and precision cout << fixed << showpoint << setprecision(2); // Main program loop // ends when _end==true while (!_end) { // Prints main option list printMainMenu(); // Switch based on response switch (_response) { // Sets pool dimensions case 1: if (pool.hasDimensions()) printHasDimensions(); else { printPoolDimensions(); printPoolVolume(); } break; // Prints pool dimensions case 2: printGetPoolDimensions(false); system("pause"); break; // Prints fill rate case 3: printGetFillRate(); break; // Prints drain rate case 4: printGetDrainRate(); break;
  • 3. // Determine water need to fill pool to capacity case 5: checkDimensions(); if (!pool.hasWater()) cout << " The pool is currently empty"; else { cout << " The pool currently has " << pool.getwerVolume() << " units" << endl; } cout << " Water needed: " << pool.getFillAmount(pool.getwerVolume()) << " units of water "; system("pause"); break; // Determine time required to fill pool at rate case 6: if (!pool.hasDimensions()) { cout << " Pool dimensions not yet entered. "; printGetPoolDimensions(false); } if (pool.getFillRate() <= 0) printGetFillRate(); cout << " Time to fill pool: " << pool.getFillTime() << endl << endl; system("pause"); break; // Determine time required to drain pool at rate case 7:
  • 4. checkDimensions(); if (_drainRate <= 0) printGetDrainRate(); if (!pool.hasWater()) { char response = printWantwer(); while (response != 'y' && response != 'n') { printError(); response = printWantwer(); } if (response == 'y') printAddWater(); else break;; } cout << " Time to drain pool: " << pool.getDrainTime() << endl << endl; system("pause"); break; case 8: checkDimensions(); if (pool.getFillRate() <= 0) printGetFillRate(); else printFillRate(); cout << " Enter fill time: "; cin >> fillTime; pool.setFillTime(fillTime); pool.setwerVolume(pool.getwerVolume() + pool.fill()); cout << endl
  • 5. << pool.fill() << " units of water were added to the pool " << " The pool now contains " << pool.getwerVolume() << " units of water "; system("pause"); break; case 9: checkDimensions(); if (pool.getDrainRate() <= 0) printGetDrainRate(); else printDrainRate(); cout << " Enter drain time: "; cin >> drainTime; pool.setDrainTime(drainTime); if (!pool.hasWater()) { char response = printWantwer(); while (response != 'y' && response != 'n') { printError(); response = printWantwer(); cout << " Response is " << response; } if (response == 'y') printAddWater(); else break; } drained = pool.drain(); cout << endl << " " << drained << " units of water were removed from the pool "
  • 6. << " The pool now contains " << pool.getwerVolume() << " units of water "; system("pause"); break; case 10: _end = true; break; default: printError(); break; } } return EXIT_SUCCESS; } void printMainMenu() { _numResponses = 6; cout << " Type the number cooresponding to the task you would like to complete: " << " 1) Set pool dimensions " << " 2) Print pool dimensions " << " 3) Set fill rate " << " 4) Set drain rate " << " Print fill and drain rates " << " Add water to pool " << " Remove water from pool " << " 5) Determine water needed to fill pool to capacity " << " Determine time required to: " << " 6) fill pool " << " 7) drain pool " << " For a specific amount of time: " << " 8) fill pool " << " 9) drain pool " << " 10) Exit Program " << " Choice: "; cin >> _response;
  • 7. } void printPoolVolume() { cout << " Pool volume is " << pool.getVolume() << endl << endl; } void printGetPoolDimensions(bool edit) { cout << " Enter pool dimensions:" << endl << " Length: "; if (edit) editValue(_length); cin >> _length; pool.setLength(_length); cout << " Width: "; if (edit) editValue(_width); cin >> _width; pool.setWidth(_width); cout << " Depth: "; if (edit) editValue(_depth); cin >> _depth; pool.setDepth(_depth); printPoolVolume(); } double editValue(double value) { cout << value; cin.seekg(0, cin.beg); cin.getline(_newValue, 5); return atof(_newValue); }
  • 8. void printHasDimensions() { _numResponses = 2; cout << " The pool already has dimensions" << endl << endl << "1) Create new dimensions" //<< endl //<< "2) Edit current dimensions" << endl << "2) Return to main menu" << endl << "Response: "; cin >> _response; switch (_response) { case 1: printGetPoolDimensions(false); break; //case 2: // // Print pool dimensions prompt with existing values // printGetPoolDimensions(true); // break; case 2: printMainMenu(); break; default: printError(); printHasDimensions(); break; } } // Function that prints an error when invalid option entered at menu void printError() { cout << "a" // make an error sound
  • 9. // print error << " You entered an invalid response, please try again" << endl << endl; } void printPoolDimensions() { cout << " Pool Dimensions " << " Length: " << _length << endl << " Width: " << _width << endl << " Depth: " << _depth << endl << endl; printPoolVolume(); } void checkDimensions() { if (!pool.hasDimensions()) { cout << " Pool dimensions not yet entered. "; printGetPoolDimensions(false); } } void printGetFillRate() { cout << " Enter the fill rate: "; cin >> _fillRate; pool.setFillRate(_fillRate); } void printGetDrainRate() {
  • 10. cout << " Enter the drain rate: "; cin >> _drainRate; pool.setDrainRate(_drainRate); } void printAddWater() { double currentwerVolume; cout << " How much water would you like to add? " << " Response: "; cin >> currentwerVolume; if (currentwerVolume > pool.getVolume()) { currentwerVolume = pool.getVolume(); cout << " You entered more than the pool could hold (" << pool.getVolume() << ") but I fixed that for you. "; } pool.setwerVolume(currentwerVolume); } void printDrainRate() { cout << " Drain rate is currently: " << pool.getDrainRate() << endl << endl; } void printFillRate() { cout << " Fill rate is currently: " << pool.getFillRate() << endl << endl; } char printWantwer() { char response;
  • 11. cout << " The pool has no water to drain! " << " Would you like to add water?" << endl << endl << " Response: "; cin >> response; return response; } SwimmingPool.h #pragma once class SwimmingPool { public: SwimmingPool(); SwimmingPool(double, double, double); SwimmingPool(double, double, double, double, double); void setLength(double); void setWidth(double); void setDepth(double); void setDrainRate(double); double getDrainRate(); void setFillRate(double); double getFillRate(); void setFillTime(int); void setDrainTime(int); void setwerVolume(double); double getVolume(); double getwerVolume(); double getFillAmount(double); int getDrainTime(); int getFillTime(); double drain(); double fill(); double fill(int); bool hasDimensions();
  • 12. bool hasWater(); private: double _length; double _width; double _depth; double _fillRate; double _drainRate; int _fillTime; int _drainTime; double _volume; double _waterVolume; }; SwimmingPool.cpp #include "SwimmingPool.h" using namespace std; // Default constructor SwimmingPool::SwimmingPool() { _length = 0; _width = 0; _depth = 0; } // Basic constructor defined with member initialization SwimmingPool::SwimmingPool (double l, double w, double d) :_length(l), _width(w), _depth(d) { // Assign to the instance variables the arguments passed to constructo _volume = _length * _width * _depth; } // Full Constructor SwimmingPool::SwimmingPool(double length, double width, double depth, double fillRate, double drainRate) { // Assign to the instance variables the arguments passed to constructor
  • 13. _length = length; _width = width; _depth = depth; _fillRate = fillRate; _drainRate = drainRate; _volume = getVolume(); // Get the volume } void SwimmingPool::setLength(double l) { _length = l; } void SwimmingPool::setWidth(double w) { _width = w; } void SwimmingPool::setDepth(double d) { _depth = d; } void SwimmingPool::setDrainRate(double r) { _drainRate = r; } double SwimmingPool::getDrainRate() { return _drainRate; } void SwimmingPool::setFillRate(double r) { _fillRate = r; } double SwimmingPool::getFillRate() { return _fillRate; }
  • 14. void SwimmingPool::setFillTime(int t) { _fillTime = t; } void SwimmingPool::setDrainTime(int t) { _drainTime = t; } // Member function to calculate volume double SwimmingPool::getVolume() { // No need to check values of instance variables // Return the volume return _length * _width * _depth; } void SwimmingPool::setwerVolume(double v) { _waterVolume = v; } double SwimmingPool::getwerVolume() { return _waterVolume; } // Returns amount of water needed to fill an empty or partially filled pool double SwimmingPool::getFillAmount(double currentwerVolume) { return getVolume() - currentwerVolume; } // Returns time needed to completely or partially drain the pool int SwimmingPool::getDrainTime() { return (int)(_waterVolume/_drainRate); } // Returns the time need to completely or partially drain the pool int SwimmingPool::getFillTime() {
  • 15. return (int)(getVolume()/_fillRate); } // Drain the pool for a specified time period // Returns adjusted water volume double SwimmingPool::drain() { double waterDrained = _drainRate * _drainTime; _waterVolume -= waterDrained; if (_waterVolume < 0) _waterVolume = 0; return waterDrained; } double SwimmingPool::fill() { _waterVolume += _fillRate * _fillTime; return _waterVolume; } // Fill the pool for a specified time period // Returns adjusted water volume double SwimmingPool::fill(int time) { return 0; } bool SwimmingPool::hasDimensions() { if (_length > 0 && _width > 0 && _depth > 0) return true; else return false; } bool SwimmingPool::hasWater() { if (_waterVolume > 0) return true; else
  • 16. return false; } Solution main.cpp #include #include #include "SwimmingPool.h" using namespace std; void printMainMenu(); void printPoolVolume(); void printGetPoolDimensions(bool); void printHasDimensions(); void checkDimensions(); void printError(); void printPoolDimensions(); double editValue(double); void printGetFillRate(); void printGetDrainRate(); void printAddWater(); void printDrainRate(); void printFillRate(); char printWantwer(); SwimmingPool pool; int _response; int _numResponses; double _length; double _width; double _depth; //double _currentwerVolume; double _drainRate; double _fillRate; bool _end; char _newValue[5];
  • 17. int main() { int fillTime; int drainTime; double drained; // Set output style and precision cout << fixed << showpoint << setprecision(2); // Main program loop // ends when _end==true while (!_end) { // Prints main option list printMainMenu(); // Switch based on response switch (_response) { // Sets pool dimensions case 1: if (pool.hasDimensions()) printHasDimensions(); else { printPoolDimensions(); printPoolVolume(); } break; // Prints pool dimensions case 2: printGetPoolDimensions(false); system("pause"); break; // Prints fill rate case 3: printGetFillRate(); break;
  • 18. // Prints drain rate case 4: printGetDrainRate(); break; // Determine water need to fill pool to capacity case 5: checkDimensions(); if (!pool.hasWater()) cout << " The pool is currently empty"; else { cout << " The pool currently has " << pool.getwerVolume() << " units" << endl; } cout << " Water needed: " << pool.getFillAmount(pool.getwerVolume()) << " units of water "; system("pause"); break; // Determine time required to fill pool at rate case 6: if (!pool.hasDimensions()) { cout << " Pool dimensions not yet entered. "; printGetPoolDimensions(false); } if (pool.getFillRate() <= 0) printGetFillRate(); cout << " Time to fill pool: " << pool.getFillTime() << endl << endl;
  • 19. system("pause"); break; // Determine time required to drain pool at rate case 7: checkDimensions(); if (_drainRate <= 0) printGetDrainRate(); if (!pool.hasWater()) { char response = printWantwer(); while (response != 'y' && response != 'n') { printError(); response = printWantwer(); } if (response == 'y') printAddWater(); else break;; } cout << " Time to drain pool: " << pool.getDrainTime() << endl << endl; system("pause"); break; case 8: checkDimensions(); if (pool.getFillRate() <= 0) printGetFillRate(); else printFillRate(); cout << " Enter fill time: ";
  • 20. cin >> fillTime; pool.setFillTime(fillTime); pool.setwerVolume(pool.getwerVolume() + pool.fill()); cout << endl << pool.fill() << " units of water were added to the pool " << " The pool now contains " << pool.getwerVolume() << " units of water "; system("pause"); break; case 9: checkDimensions(); if (pool.getDrainRate() <= 0) printGetDrainRate(); else printDrainRate(); cout << " Enter drain time: "; cin >> drainTime; pool.setDrainTime(drainTime); if (!pool.hasWater()) { char response = printWantwer(); while (response != 'y' && response != 'n') { printError(); response = printWantwer(); cout << " Response is " << response; } if (response == 'y') printAddWater(); else break; } drained = pool.drain();
  • 21. cout << endl << " " << drained << " units of water were removed from the pool " << " The pool now contains " << pool.getwerVolume() << " units of water "; system("pause"); break; case 10: _end = true; break; default: printError(); break; } } return EXIT_SUCCESS; } void printMainMenu() { _numResponses = 6; cout << " Type the number cooresponding to the task you would like to complete: " << " 1) Set pool dimensions " << " 2) Print pool dimensions " << " 3) Set fill rate " << " 4) Set drain rate " << " Print fill and drain rates " << " Add water to pool " << " Remove water from pool " << " 5) Determine water needed to fill pool to capacity " << " Determine time required to: " << " 6) fill pool " << " 7) drain pool " << " For a specific amount of time: " << " 8) fill pool "
  • 22. << " 9) drain pool " << " 10) Exit Program " << " Choice: "; cin >> _response; } void printPoolVolume() { cout << " Pool volume is " << pool.getVolume() << endl << endl; } void printGetPoolDimensions(bool edit) { cout << " Enter pool dimensions:" << endl << " Length: "; if (edit) editValue(_length); cin >> _length; pool.setLength(_length); cout << " Width: "; if (edit) editValue(_width); cin >> _width; pool.setWidth(_width); cout << " Depth: "; if (edit) editValue(_depth); cin >> _depth; pool.setDepth(_depth); printPoolVolume(); } double editValue(double value) { cout << value;
  • 23. cin.seekg(0, cin.beg); cin.getline(_newValue, 5); return atof(_newValue); } void printHasDimensions() { _numResponses = 2; cout << " The pool already has dimensions" << endl << endl << "1) Create new dimensions" //<< endl //<< "2) Edit current dimensions" << endl << "2) Return to main menu" << endl << "Response: "; cin >> _response; switch (_response) { case 1: printGetPoolDimensions(false); break; //case 2: // // Print pool dimensions prompt with existing values // printGetPoolDimensions(true); // break; case 2: printMainMenu(); break; default: printError(); printHasDimensions(); break; } }
  • 24. // Function that prints an error when invalid option entered at menu void printError() { cout << "a" // make an error sound // print error << " You entered an invalid response, please try again" << endl << endl; } void printPoolDimensions() { cout << " Pool Dimensions " << " Length: " << _length << endl << " Width: " << _width << endl << " Depth: " << _depth << endl << endl; printPoolVolume(); } void checkDimensions() { if (!pool.hasDimensions()) { cout << " Pool dimensions not yet entered. "; printGetPoolDimensions(false); } } void printGetFillRate() { cout << " Enter the fill rate: "; cin >> _fillRate;
  • 25. pool.setFillRate(_fillRate); } void printGetDrainRate() { cout << " Enter the drain rate: "; cin >> _drainRate; pool.setDrainRate(_drainRate); } void printAddWater() { double currentwerVolume; cout << " How much water would you like to add? " << " Response: "; cin >> currentwerVolume; if (currentwerVolume > pool.getVolume()) { currentwerVolume = pool.getVolume(); cout << " You entered more than the pool could hold (" << pool.getVolume() << ") but I fixed that for you. "; } pool.setwerVolume(currentwerVolume); } void printDrainRate() { cout << " Drain rate is currently: " << pool.getDrainRate() << endl << endl; } void printFillRate() { cout << " Fill rate is currently: " << pool.getFillRate() << endl << endl;
  • 26. } char printWantwer() { char response; cout << " The pool has no water to drain! " << " Would you like to add water?" << endl << endl << " Response: "; cin >> response; return response; } SwimmingPool.h #pragma once class SwimmingPool { public: SwimmingPool(); SwimmingPool(double, double, double); SwimmingPool(double, double, double, double, double); void setLength(double); void setWidth(double); void setDepth(double); void setDrainRate(double); double getDrainRate(); void setFillRate(double); double getFillRate(); void setFillTime(int); void setDrainTime(int); void setwerVolume(double); double getVolume(); double getwerVolume(); double getFillAmount(double); int getDrainTime(); int getFillTime();
  • 27. double drain(); double fill(); double fill(int); bool hasDimensions(); bool hasWater(); private: double _length; double _width; double _depth; double _fillRate; double _drainRate; int _fillTime; int _drainTime; double _volume; double _waterVolume; }; SwimmingPool.cpp #include "SwimmingPool.h" using namespace std; // Default constructor SwimmingPool::SwimmingPool() { _length = 0; _width = 0; _depth = 0; } // Basic constructor defined with member initialization SwimmingPool::SwimmingPool (double l, double w, double d) :_length(l), _width(w), _depth(d) { // Assign to the instance variables the arguments passed to constructo _volume = _length * _width * _depth; } // Full Constructor
  • 28. SwimmingPool::SwimmingPool(double length, double width, double depth, double fillRate, double drainRate) { // Assign to the instance variables the arguments passed to constructor _length = length; _width = width; _depth = depth; _fillRate = fillRate; _drainRate = drainRate; _volume = getVolume(); // Get the volume } void SwimmingPool::setLength(double l) { _length = l; } void SwimmingPool::setWidth(double w) { _width = w; } void SwimmingPool::setDepth(double d) { _depth = d; } void SwimmingPool::setDrainRate(double r) { _drainRate = r; } double SwimmingPool::getDrainRate() { return _drainRate; } void SwimmingPool::setFillRate(double r) { _fillRate = r; }
  • 29. double SwimmingPool::getFillRate() { return _fillRate; } void SwimmingPool::setFillTime(int t) { _fillTime = t; } void SwimmingPool::setDrainTime(int t) { _drainTime = t; } // Member function to calculate volume double SwimmingPool::getVolume() { // No need to check values of instance variables // Return the volume return _length * _width * _depth; } void SwimmingPool::setwerVolume(double v) { _waterVolume = v; } double SwimmingPool::getwerVolume() { return _waterVolume; } // Returns amount of water needed to fill an empty or partially filled pool double SwimmingPool::getFillAmount(double currentwerVolume) { return getVolume() - currentwerVolume; } // Returns time needed to completely or partially drain the pool int SwimmingPool::getDrainTime() { return (int)(_waterVolume/_drainRate);
  • 30. } // Returns the time need to completely or partially drain the pool int SwimmingPool::getFillTime() { return (int)(getVolume()/_fillRate); } // Drain the pool for a specified time period // Returns adjusted water volume double SwimmingPool::drain() { double waterDrained = _drainRate * _drainTime; _waterVolume -= waterDrained; if (_waterVolume < 0) _waterVolume = 0; return waterDrained; } double SwimmingPool::fill() { _waterVolume += _fillRate * _fillTime; return _waterVolume; } // Fill the pool for a specified time period // Returns adjusted water volume double SwimmingPool::fill(int time) { return 0; } bool SwimmingPool::hasDimensions() { if (_length > 0 && _width > 0 && _depth > 0) return true; else return false; } bool SwimmingPool::hasWater()
  • 31. { if (_waterVolume > 0) return true; else return false; }