Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Main program
- #include <iostream>
- #include "swimming_pool_header.h"
- using namespace std;
- int main()
- {
- swimmingPool pool(30, 15, 10, 0, 0, 100);
- double waterFRate;
- double waterDRate;
- int galAdd;
- int galDrain;
- int time;
- int selection;
- char exitSelection;
- cout << "Pool data: " << endl;
- cout << " Length: " << pool.getLength() << endl;
- cout << " Width: " << pool.getWidth() << endl;
- cout << " Depth: " << pool.getDepth() << endl;
- cout << " Total capacity of pool (Cubic Gallons): " << pool.poolTotalWaterCapacity() << endl;
- cout << " Total water in the pool: " << pool.getTotalWaterInPool() << endl;
- do {
- cout << "Menu: \n";
- cout << "1. Fill the pool.\n";
- cout << "2. Drain the pool.\n";
- cout << "3. Add water to the pool.\n";
- cout << "4. Drain water from the pool.\n";
- cout << "5. Exit\n";
- cin >> selection;
- if (selection == 1) {
- cout << "Enter water fill in rate (in Gallons per min): ";
- cin >> waterFRate;
- cout << endl;
- pool.setWaterFlowRateIn(waterFRate);
- cout << endl;
- cout << " Water In Flow Rate: " << pool.getWaterFlowRateIn() << endl;
- cout << " Water needed to fill the pool (cubic gallons): " << pool.waterNeededToFillThePool() << endl;
- time = pool.timeToFillThePool();
- cout << " Time to fill the pool is appriximately: "
- << time / 60 << " hour(s) and " << time % 60
- << " minute(s)." << endl;
- }
- else if (selection == 2) {
- cout << "Enter water drain rate (in Gallons per min): ";
- cin >> waterDRate;
- cout << endl;
- pool.setWaterFlowRateOut(waterDRate);
- cout << endl;
- cout << " Water Out Flow Rate: " << pool.getWaterFlowRateOut() << endl;
- cout << " Water needed to drain from the pool (cubic gallons): " << pool.waterNeededToDrainThePool() << endl;
- time = pool.timeToDrainThePool();
- cout << " Time to drain the pool is appriximately: "
- << time / 60 << " hour(s) and " << time % 60
- << " minute(s)." << endl;
- }
- else if (selection == 3) {
- cout << "Enter how many gallons of water you would like to add: \n" << endl;
- cin >> galAdd;
- pool.addWater(galAdd);
- cout << endl;
- cout << "Updated amount of water in pool: " << pool.getTotalWaterInPool() << endl;
- }
- else if (selection == 4) {
- cout << "Enter how many gallons of water you would like to remove: \n" << endl;
- cin >> galDrain;
- pool.drainWater(galDrain);
- cout << endl;
- cout << "Update amount of water in pool: " << pool.getTotalWaterInPool() << endl;
- }
- else if (selection >= 5)
- exit(0);
- } while (selection >= 1);
- return 0;
- }
Add Comment
Please, Sign In to add comment