summaryrefslogtreecommitdiff
path: root/CST116-Lab2-Crombie-pseudocode.txt
blob: 3a5f4eff096636f5719c94c4ab8cbe55e10786e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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