Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to write a program that will calculate the heat transfer of a substance (

ID: 3550390 • Letter: I

Question

I have to write a program that will calculate the heat transfer of a substance (water) given three different shapes. The user has to be able to input the type of shape, so that the computer can calculate area, and plug it back in to the equation for heat transfer. The equation for heat transfer is given as:


q = (h)*(A)*(Ts-Ta)


q= heat transfer

A = area of the user inputted shape

Ts= surface tempurature

Ta= ambient tempurature

h= convective heat transfer coeeficient (given as 8.7 W/(C*m^2)


The three different shapes that have to be calculated for area (user choice) are:


1-A rectangular area

2-An elliptical area

3- Other area


The equation for an elliptical area is given as pi*(little radius)*(big radius)

For 'other' area, the user just imputs the area.


Here is my program so far. Could you please tell me what I'm doing wrong? I'm getting a ton of error messages.


/* The contained program is designed to calculate the heat transfer per unit area of a substance

*/

#include <iostream>

#include <cmath>

using namespace std;


int main()

{

    int shape(0);

    double  s1, s2, q, h(8.7), Ts, Ta, rl, rs, A, PI;

    PI = acos(-1);

    h = 8.7;

    cout<<" enter your surface Tempurature:";

    cin>>Ts;

    cout<<" enter the ambient (surrounding) Tempurature:";

    cin>>Ta;

    cin>>shape;

    switch(shape)

    {


    case 1://execute before the next major break statment is Shape = 1

        cout<<" enter the length of side 1:";

        cin>>s1;

        cout<<" enter the length of side 2:";

        cin>>s2;

        cout<<" your area in case 1 is:";

        A = s1*s2;

        cout<<A<<endl;

        break;//go to the end of switch block


    case 2://execute the code before the next break statement if Shape = 2

        cout<<" enter the radius of the minor axis:";

        cin>>rs;

        cout<<" enter the radius of the major axis:";

        cin>>rl;

        A = (PI*rl*rs)>>endl;

        cout<<A<<endl;

        break;//go to the end of switch block


    case 3://execute beofore the next major break if statement is Shape = 3

        cout<<" enter your Area:";

        cin>>A;

        break;//go to the end of switch block

    }//end of switch


    cout<<" determine your surface area:";

    q = h*A*(Ts-Ta);

    cout<<" The heat transfer of the substance is:"<<q<<endl;




    return 0;

}

Explanation / Answer

// line 36 is wrong? A = (PI*rl*rs)>>endl;

/* The contained program is designed to calculate the heat transfer per unit area of a substance

*/

#include <iostream>

#include <cmath>

using namespace std;


int main()

{

int shape(0);

double s1, s2, q, h(8.7), Ts, Ta, rl, rs, A, PI;

PI = acos(-1);

h = 8.7;

cout<<" enter your surface Tempurature:";

cin>>Ts;

cout<<" enter the ambient (surrounding) Tempurature:";

cin>>Ta;

cin>>shape;

switch(shape)

{


case 1://execute before the next major break statment is Shape = 1

cout<<" enter the length of side 1:";

cin>>s1;

cout<<" enter the length of side 2:";

cin>>s2;

cout<<" your area in case 1 is:";

A = s1*s2;

cout<<A<<endl;

break;//go to the end of switch block


case 2://execute the code before the next break statement if Shape = 2

cout<<" enter the radius of the minor axis:";

cin>>rs;

cout<<" enter the radius of the major axis:";

cin>>rl;

A = (PI*rl*rs);

cout<<A<<endl;

break;//go to the end of switch block


case 3://execute beofore the next major break if statement is Shape = 3

cout<<" enter your Area:";

cin>>A;

break;//go to the end of switch block

}//end of switch


cout<<" determine your surface area:";

q = h*A*(Ts-Ta);

cout<<" The heat transfer of the substance is:"<<q<<endl;




return 0;

}