1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
#include <iostream>
using namespace std;
double calc_BTUs (double volume);
char select_AC(double BTUs);
char A, B, C, D, E, F, G;
int main()
{
double length, width, height, Cubicfoot;
char uI;
do{
cout << "Please enter the dimensions of the cabin in feet." << endl;
cout << "Length: ";
cin >> length;
cout << "Width: ";
cin >> width;
cout << "Height: ";
cin >> height;
Cubicfoot = length * width * height;
double BTUs = calc_BTUs(Cubicfoot);
cout << "Your " << Cubicfoot << " cubic foot cabin will need " << BTUs << " BTU's of cooling power." << endl;
char AC = select_AC(BTUs);
cout << "This may be met by installing the '" << AC << "' type A/C unit" << endl;
cout << "Do you want to try again? (Y/N) ";
cin >> uI;
} while (uI == 'y' || uI == 'Y');
system("pause");
return 0;
}
/*
inputs:
volume - length * width * height
outputs: none
return: returns the number of BTU's needed for the Cubic feet of the Cabin
*/
double calc_BTUs( double volume)
{
return volume/ 680 *1000;
}
char select_AC(double BTUs)
{
char A, B, C, D, E, F, G;
if (BTUs >= 14000)
return A;
else if (BTUs >= 29000)
return B;
else if (BTUs >= 45000)
return C;
else if (BTUs >= 61000)
return D;
else if (BTUs >= 75000)
return E;
else if (BTUs >= 100000)
return F;
else
return G;
}
|