{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW5_Curtis_ryan

# HW5_Curtis_ryan - 10W-GV HW5 Ryan Curtis Problem ID Scholar...

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

10W-GV 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.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}