diff options
| author | JonCr <[email protected]> | 2022-11-12 00:13:03 -0800 |
|---|---|---|
| committer | JonCr <[email protected]> | 2022-11-12 00:13:03 -0800 |
| commit | 875dfeb5d3703a33a6f0260eb0c8af4306af3b51 (patch) | |
| tree | c6ec09ca90147daab9cb3317d34984eeba416b0a /CST116-Lab2-Crombie-pseudocode.txt | |
| parent | Update (diff) | |
| download | cst116-lab2-cognitiveshadow-master.tar.xz cst116-lab2-cognitiveshadow-master.zip | |
Diffstat (limited to 'CST116-Lab2-Crombie-pseudocode.txt')
| -rw-r--r-- | CST116-Lab2-Crombie-pseudocode.txt | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/CST116-Lab2-Crombie-pseudocode.txt b/CST116-Lab2-Crombie-pseudocode.txt new file mode 100644 index 0000000..3a5f4ef --- /dev/null +++ b/CST116-Lab2-Crombie-pseudocode.txt @@ -0,0 +1,60 @@ +Declare temp +Set select equal to 0 +Set windSpeed equal to 0 +Run function selectType + Set choose equal to '0' + While select does not equal 1 and select does not equal 2 + Print "Enter temperature in Fahrenheit or Celsius?" + [1] Fahrenheit + [2] Celsius + Selection: " + Input choose + If choose is equal to '1' + Set select equal to 1 + Else if choose is equal to '2' + Set select equal to 2 + Else print "Please enter only 1 or 2." + Return select +Set select equal to return of function selectType +Run function getTemp, inputting select + Set temp equal to -100 + Set constant minC equal to -62 + Set constant maxC equal to 49.5 + Set constant minF equal to -80 + Set constant maxF equal to 121 + If select is equal to 1 + While temp is less than minF or temp is greater than maxF + Print "Enter temperature: " + Input temp + If temp is less than minF or temp is greater than maxF + Print "Please enter between " minF " and " maxF "." + If select is equal to 2 + While temp is less than minC or temp is greater than maxC + Print "Enter temperature: " + Input temp + If temp is less than minC or temp is greater than maxC + Print "Please enter between " minC " and " maxC "." + Return temp +Set temp equal to return of function getTemp +If select is equal to 2 + Run function calcTemp, inputting temp + Give temp alias Celsius + Set Fahrenheit equal to 0 + Set Fahrenheit equal to 32 + ((9 * Celsius) / 5) + Return Fahrenheit + Set temp equal to return of function calcTemp +Run function getWindSpeed + Set windSpeed equal to -100 + While windSpeed is less than 0 or windSpeed is greater than 231 + Print "Enter wind speed in MPH: " + Input windSpeed + If windSpeed is less than 0 or windSpeed is greater than 231 + Print "Please enter between 0 and 231." + Return windSpeed +Set windSpeed equal to return of function getWindSpeed +Run function calcWindChill, inputting temp and windSpeed + Set windChill equal to 0 + Set windChill equal to 35.74 + 0.6215 * temp - 35.75 * windSpeed ^ 0.16 + 0.4275 * temp * windSpeed ^ 0.16 + Print "For temperatures of " temp " degrees Fahrenheit and wind speeds of " windSpeed " MPH, the windchill is " windChill +Return 0 + |