aboutsummaryrefslogtreecommitdiff
path: root/CST116-Lab2-PseudoCode-Preston.txt
blob: e8b7e6b64af7ef24b899a72463dfcbd183f8c222 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Pseudocode for Lab 2

float cel
float far
float mph
float chill
float newFar

const min/max for far, cel, mph

string check
const string celcheck

float celtofar(cel)
float getParam(far&, mph&)
float windchill(far, mph)
float getMPH(mph&)

main begin
	far = 0
	cel = 0
	mph = 0

	print do you want to enter cel or far
	input check

	if check == celcheck
		celtofar(cel)
		far = newFar
		getMPH(mph)
	else 
		getParam(far, mph)

	windchill(far, mph)

	print you entered + far + F
	print for + far + degrees F and + mph + MPH wind speed + the windchill is + chill 

end main funciton

float getParam(float& far, float& mph)
	print enter far temp
	print must be between farmin and farmax
	input far
	while (far < farmin OR far > farmax)
		print enter far temp
		print must be between farmin and farmax
		input far
	print enter wind speed in mph
	print must be between mphmin and mphmax
	input mph
	while (mph < mphmin OR mph > mphmax)
		print enter wind speed in mph
		print must be between mphmin and mphmax
		input mph
	return far, mph

float celtofar(float cel)
	print enter your cel temp
	print must be between celmin and celmax
	input cel
	while (cel < celmin OR cel > celmax)
		print enter your cel temp
		print must be between celmin and celmax
		input cel
	newFar = (9/5) x cel + 32
	return newFar

float getMPH(float& mph)
	print enter wind speed in mph
	print must be between mphmin and mphmax
	input mph
	while (mph < mphmin OR mph > mphmax)
		print enter wind speed in mph
		print must be between mphmin and mphmax
		input mph
	return mph

float windchill(float far, float mph)
	chill = 35.74 + (.6215 * far) - (35.75 * mph^.16) + (.4275 * mph^.16)
	return chill