Develop a collection of functions to solve conduction problems using various forms of the formula H = kA(T2 - T1) / X
#include
using namespace std;
double calcH (double k, double A, double T2, double T1, double X);
double calck (double H, double A, double T2, double T1, double X);
double calcA (double H, double k, double T2, double T1, double X);
double calcT1 (double H, double k, double A, double T2, double X);
double calcT2 (double H, double k, double A, double T1, double X);
double calcX (double H, double k, double A, double T2, double T1);
```
int main()
{
double H, // rate of heat transfer in watts
k, // thermal conductivity coefficient
A, // cross sectional area in m^2
T1, // kelvin temperature on one side
T2, // kelvin temperature on the other side
X; // thickness of conductor in m^2
char skipChar,// reads in '?'
solve; // which variable to solve for
cout << endl;
cout << "Respond to the prompts with the data known. For the unknown"
<< endl
<< "quantity, enter a question mark (?)." << endl << endl;
cout << "Rate of heat transfer (watts) => ";
cin >> H;
if (cin.fail()){
cin.clear();
cin >> skipChar; // read '?'
solve = 'H';
}
cout << "Coefficient of thermal conductivity (W/m-K) => ";
cin >> k;
if (cin.fail()){
cin.clear();
cin >> skipChar; // read '?'
solve = 'k';
}
cout << "Cross-sectional area of conductor (m^2) => ";
cin >> A;
if (cin.fail()){
cin.clear();
cin >> skipChar; // read '?'
solve = 'A';
}
cout << "Temperature on one side (K) => ";
cin >> T2;
if (cin.fail()){
cin.clear();
cin >> skipChar; // read '?'
solve = '2';
}
cout << "Temperature on other side (K) => ";
cin >> T1;
if (cin.fail()){
cin.clear();
cin >> skipChar; // read '?'
solve = '1';
}
cout << "Thickness of conductor (m) => ";
cin >> X;
if (cin.fail()){
cin.clear();
cin >> skipChar; // read '?'
solve = 'X';
}
cout << endl << " kA (T2 - T1)" << endl
<< " H = --------------" << endl
<< " X" << endl;
switch (solve){
case 'H':
H = calcH (k, A, T2, T1, X);
cout << endl << "Rate of heat transfer is "
<< H << " W" << endl;
break;
case 'k':
k = calck (H, A, T2, T1, X);
cout << endl << "Thermal conductivity coefficient is "
<< k << " W/m-k" << endl;
break;
case 'A':
A = calcA (H, k, T2, T1, X);
cout << endl << "Cross-sectional area of conductor is "
<< A << " m^2" << endl;
break;
case '2':
T2 = calcT2 (H, k, A, T1, X);
cout << endl << "Temperature on one side is "
<< T2 << " K" << endl;
break;
case '1':
T1 = calcT1 (H, k, A, T2, X);
cout << endl << "Temperature on the other side is "
<
case 'X':
X = calcX (H, k, A, T2, T1);
cout << endl << "Thickness of conductor is "
<< X <<" m" << endl;
break;
}
cout << endl << "H = " << H << " W" << endl
<< "k = " << k << " W/m-K" << endl
<< "A = " << A << " m^2" << endl
<< "T2 = " << T2 << " K" << endl
<< "T1 = " << T1 << " K" << endl
<< "X = " << X << " m" << endl << endl;
return 0;
}
```
You might also like to view...
What is the purpose of offering discounts? Do you think that clients are saving too much money, possibly causing negative consequences for the agency?
What will be an ideal response?
Any step you take to ward off a threat is called a:
A. countermeasure B. risk C. vulnerability D. TPS
What are some other modes of access that users might want to apply to code or data, in addition to the common read, write, and execute permission?
What will be an ideal response?
Which of the following is most similar to the browser on Android devices?
A. Safari B. Internet Explorer 9 C. Chrome D. Firefox