/** * * Project 1 - Refugee water needs calculator * * @author Clay Shields * **/ #include #include using namespace std; int main() { const double minWaterPerPersonPerDay = 7.5; const double maxWaterPerPersonPerDay = 15; const double tapLitersPerMinute = 7.5; const double pumpLitersPerMinute = 17; const double wellLitersPerMinute = 12.5; const double litersToGallons = 3.78541; const double waterBufffaloCapacityGallons = 400; const double waterBuffaloCapacityLiters = 400 * litersToGallons; const int minutesWaterPerDay = 60 * 8; int numberOfRefugees = 0; double litersPerDayPerPerson = 0; int numberOfTaps = 0; int numberOfWells = 0; int numberOfPumps = 0; int numberOfBuffalosNeeded = 0; double waterNeeded = 0; double waterAvailable = 0; int refugeeCapacity = 0; double waterDeficit = 0; cout << "This program will determine the water needs for a refugee camp" << endl; cout << "based on the number of refugees, daily water needs, and the existing" << endl; cout << "water supplies." << endl << endl; cout << "Please enter the number of refugees: "; cin >> numberOfRefugees; cout << endl; cout << "Please enter the daily water needs for each person (in the range" << endl; cout << minWaterPerPersonPerDay << " liters/day to " << maxWaterPerPersonPerDay << " liters/day):"; cin >> litersPerDayPerPerson; if ((litersPerDayPerPerson < minWaterPerPersonPerDay) || (litersPerDayPerPerson > maxWaterPerPersonPerDay)) { cout << "WARNING: The water needs entered seem out of range for the minimum" << endl; cout << " standards in water supply, sanitation and hygiene promotion according" << endl; cout << "to the Sphere Project Minimum Standards in Humanitarian Response" << endl; } if (litersPerDayPerPerson <= 0) { cout << "Zero liters per day will lead to death." << endl; return 0; } cout << "Enter the number of working taps in the camp: "; cin >> numberOfTaps; cout << "Enter the number of working pumps in the camp: "; cin >> numberOfPumps; cout << "Enter the number of working wells in the camp: "; cin >> numberOfWells; cout << endl << endl; //Calculate the daily water needs waterNeeded = litersPerDayPerPerson * numberOfRefugees; //Calculate the water available waterAvailable = (((numberOfTaps * tapLitersPerMinute) + (numberOfPumps * pumpLitersPerMinute) + (numberOfWells * wellLitersPerMinute)) * minutesWaterPerDay); if (waterNeeded < waterAvailable) { refugeeCapacity = (waterAvailable - waterNeeded) / litersPerDayPerPerson; cout << "There is adequate water for the camp, which can support an additional " << refugeeCapacity << " people" << endl; } else { waterDeficit = waterNeeded - waterAvailable; cout << "The camp is short of water by " << waterDeficit << " liters/day." << endl;; numberOfBuffalosNeeded = ceil(waterDeficit / waterBuffaloCapacityLiters); cout << "You will need to provide as additional " << numberOfBuffalosNeeded << " M149 Water Buffalos per day" << endl; } }