diff options
| author | Andrei F <[email protected]> | 2022-11-09 16:28:23 -0800 |
|---|---|---|
| committer | Andrei F <[email protected]> | 2022-11-09 16:28:23 -0800 |
| commit | bf6da7098c007ea8d3569006eeb6f402046d0aae (patch) | |
| tree | a2f68ea54e2177685bc8ad8cc67d9fd4576292ac | |
| parent | Added output file (diff) | |
| download | cst116-lab2-florea-bf6da7098c007ea8d3569006eeb6f402046d0aae.tar.xz cst116-lab2-florea-bf6da7098c007ea8d3569006eeb6f402046d0aae.zip | |
Finished PseudoCode
| -rw-r--r-- | CST116-Lab2-PseudoCode-Florea.txt | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/CST116-Lab2-PseudoCode-Florea.txt b/CST116-Lab2-PseudoCode-Florea.txt index e69de29..60b7370 100644 --- a/CST116-Lab2-PseudoCode-Florea.txt +++ b/CST116-Lab2-PseudoCode-Florea.txt @@ -0,0 +1,69 @@ +prototype func user_entry_temp +prototype func user_entry_speed +prototype func convert_to_f +prototype func calculate_wind_chill + +initiate var F_MAX as const int, set it to 121 +initiate var F_MIN as const int, set it to -80 + +initiate var C_MAX as const float, set it to 42.5 +initiate var C_MIN as const int, set it to -62 + +initiate var W_MAX as const int, set it to 231 +initiate var W_MIN as const int, set it to 0 + +def func int main + initiate var temperature as float, set it to -100 + initiate var wind_speed as float, set it to -100 + initiate var chill as float + initiate var temp_decision as char + + display "Do you want temp in Fahrenheit or Celsius?" + take input for temp_decision + call tolower on temp_decision + + call func user_entry_temp(pass temperature, pass temp_decision) + call func user_entry_speed(pass wind_speed) + + call func calculate_wind_chill(pass temperature, pass wind_speed) set it to chill + call func toupper on temp_decision + + display "For " + temperature + " degrees " + temp_decision + " and " + wind_speed + " mph" + display " the wind chill is: " + chill + + +def func void user_entry_speed(float reference temperature, char decision) + if decision is not equal to f or c + while decision is not f and not C + display "Wrong input for temp, do you want temp in F or C" + take input for decision + call func tolower on decision + + if decision is equal to c + while temperature less than C_MIN and more than C_MAX + display "Enter value for temp in Celsius" + take input for temperature + + display "You entered " + temperature + " degrees celsius" + call func convert_to_f and set return to temperature + + else if decision is equal to f + while temperature is less than F_MIN or more than F_MAX + display "Enter a value in Farnheit for temperature" + take input for temperature + + display "You entered " + temperature + " degrees Fahrenheit" + +def func void user_entry_speed(float reference wind_speed) + while wind_speed is less than W_MIN or more than W_MAX + display "Enter a speed for the wind" + take input for wind_speed + + display "You entered " + wind_speed + " mph" + +def func float convert_to_f(float c_temp) + c_temp = 1.8 * c_temp + 32 + return c_temp + +def func calculate_wind_chill(float temp, float wind) + return 35.75 + .6215 * temp - 35.75 * wind^.16 + .4275 * temp * wind^.16
\ No newline at end of file |