Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description: The topic of this programming assignment is heat transfer (conduction) from one side of a wall to another, such as from the inside of

Description:

The topic of this programming assignment is heat transfer (conduction) from one side of a wall to another, such as from the inside of a house to the outside.

The rate of heat transfer is given by the following formula:

h= a((T2-T1)/(TH/K))

where:

h is the heat transfer rate (Btu/hr)

a is the surface area (ft2)

th is the thickness (ft)

k is the thermal conductivity constant for the wall (dependent on how readily the wall

material will conduct heat)

t1 and t2 are the temperatures ( F) on either side of the wall.

The term th/k happens to be the R value of the material, which can be seen printed on packages of insulation.

The following table provides some examples of typical building materials, sample thickness values, and k constant values. (Note that the sample thickness values in the table are in inches, and k is using feet).

Material

Thickness (in.)

k ( BTU/ (hr*ft* F))

Hardwood siding

1.0

0.092

Concrete block

6.0

0.260

Styrofoam

1.0

0.017

Fiberglass batting

6.0

0.027

Drywall

0.5

0.093

Instructions:

Complete pre-work in the lab report:

Describe, analyze, and document your program using the Lab Report template.

Use k values associated with various building materials in the table, as well as user input data values for a, th, t1, and t2 .

Prompt the user for his/her first name and save the name.

Present a menu of material choices and allow the user to select the material desired.

Construct an algorithm in your lab report to compute the heat transfer rate across the wall, using the input data values and the k value for the material.

Display as output the heat transfer rate h and the R value of the material (the value of th/k), along with explanatory text, including the users name.

Consider any assumptions as well as what would be considered invalid user input values.

Compute an example solution by hand for the first material in the table, following the steps in your algorithm.

Construct a simplified test plan for your program (see example in separate file). This test plan will only check if a valid selection of material is made. All other input values should remain the same for each test case. (Extra credit for adding additional tests in your test plan.)

I have written a code for this problem already. But everytime I try compiling and imputing random value I get the same answer. What am I doing wrong?

#include #include int main()

{ //Declaring variables int choice; double temp1; double temp2; double thick; double value; double total; double area; //surface area of wall char userName;

//Get and print values for Teperature 1, Temperature 2, Surface Area, and thickness printf("Enter Temperature 1 in degrees Farenheit "); scanf("%d", &temp1);

printf("Enter Temperature 2 in degrees Farenheit "); scanf("%d", &temp2);

printf("Enter Surface Area in ft^2 "); scanf("%d", &area);

printf("Enter Thickness in feet "); scanf("%d", &thick);

//Display Materials Menu printf("What building material are you using? "); printf(" 1. Hardwood Siding "); printf(" 2. Concrete Block "); printf(" 3. Styrofoam "); printf(" 4. Fiberglass batting "); printf(" 5. Drywall "); printf(" Select a building material from 1-5: "); scanf("%d", &choice); printf("Your choice was: %d ",choice); //Prompt user to select a meterial, use if and else statements to determine thickness and thermal conductivity of material. Include statemnt that does not allow any other values. if (choice == 1) { value = 0.092; //thermalConductivity = 0.092; total = area * (temp2 - temp1 ) / (thick / value); } else if (choice == 2) { value = 0.26; //thermalConductivity = 0.26; total = area * (temp2 - temp1) / (thick / value); } else if (choice == 3) { value = 0.017; //thermalConductivity=0.017; total = area * (temp2 - temp1) / (thick / value); } else if (choice == 4) { value = 0.027; //thermalConductivity = 0.027; total = area * (temp2 - temp1) / (thick / value); } else if (choice ==5) { value = 0.093; //thermalConductivity = 0.093; total = area * (temp2 - temp1) / (thick / value); } else { printf("Invalid! The selection must be 1-5. "); } printf("Your total heat transfer is: %d ",total);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

2. What should an employer do when facing an OSHA inspection?

Answered: 1 week ago