HW5_Curtis_ryan

HW5_Curtis_ryan - 10W-GV HW5 2/16/11 Ryan Curtis Problem...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
HW5 2/16/11 Ryan Curtis 1 Problem ID: Scholar HW5 Problem 1 Problem Statement: Create a program that will ask the user to input a unknown temperature reading and will display the number in Celsius, Fahrenheit, Kelvin, and Rankine. The program will display the readings as a vector. Diagram: N/A Solution : Flowchart: START n = 0 Response = y TotalC=0 TotalF=0 TotalK=0 TotalR = 0 While Response = y n = n + 1 Input Scale(n) While Scale = c or f or k or r. Input Scale(n) If Scale(n) = C If Scale(n) = F If Scale(n) = K Input Temperature Input Temperature Input Temperature Input Rankine(n) Input Response y or n For i = 1:1:n TempC(n) = Temperature TempC(n) = (Temperature-32)·(5/9) TempC(n) = Temperature -273.15 TempC(n) = (Temperature-32-459.67)/1.8 TempF(n) = TempC(n)·(9/5)+32 TempK(n) = TempC(n)+273.15 TempR(n) = TempC(n)·(9/5)+32+459.67 TotalC = TotalC+TempC(n) TotalF= TotalF+TempF(n) TotalK = TotalK+TempK(n) TotalR = TotalR+TempR(n) 1 AvgC = TotalC/n AvgF = TotalF/n AvgK = TotalK/n AvgR = TotalR/n Output TempC(n) TempF(n) TempK(n) TempR(n) AvgC AvgF AvgK AvgR 1 Listing: %Create a program that will ask the user to input a unknown temperature reading %and will display the number in Celsius, Fahrenheit, Kelvin, and Rankine. The %program will display the readings as a vector. n = 0; %initialize number response = 'y' ; %initialize response TotalC = 0; %initialize total celsius values TotalF = 0; %initialize total farhenheit values TotalK = 0;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/02/2011 for the course ENGE 1114 taught by Professor Twknott during the Spring '06 term at Virginia Tech.

Page1 / 6

HW5_Curtis_ryan - 10W-GV HW5 2/16/11 Ryan Curtis Problem...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online