summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/CST116-Lab2-Ahmed-Pseudocodetxt.txt
blob: 8235fbe0067f31baa231f0c4e6faa11761ede2c1 (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
82
Start main

initialize const int MINF to be -80
initialize const int MAXF to be 121
initialize const int MINC to be -62
initialize const int MAXC to be 49.5

initialize a float c to 0
initialize a float f to 0
initialize a float w

initialize a string temp

initialize a boolean range to be false
initialize a boolean tilSpeed to bbe false
initialize a boolean i isF to be false

prompt the user to enter either F or C for temperature units

while the boolean range is false
	if the string temp is equal to C
		range is equal to true
		ask the user to enter a temperature between -62 and 49.5
		if the input less than MINC or greater than MAXC 
			set range to false
		else
			print out a statment allowing the user to see the temperature in celsius and the conversion to fahrenheit
			set tilSpeed to true

	else if temp is equal F
		ask the user to enter a vlue between -80 and 121
		if the input is less than <INF or greater than MAXF
			set range to false
		else
			print out the temperature entered by the user
			set tilSpeed to tue
	else
		ask the user to re-enter their selection og C or F
		store in temp

	if range is true
		tilSpeed to true
		ask the user to input a value between 0 and 231
			store in w
		while the value is not between 231 and 0, then keep asking the user for an input

if the value of c is not 0
	set isF to false
	print out the final output with a decimal precision of 2 in celsius with a call to output and windChill

else if the value of f is not 0
	set isF to true
	print out the final output with a decimal precision of 2 in fahrenheit  with a call to output and windChill





cToF function definition
	takes an input of a float a
	initializes a temporary variable, temp, as a float
	sets temp equal to the conversion of celsius to fahrenheit
	returns temp 

windChill function definition
	Takes an input of d and w and boolean x by reference 
	initializes a variable out to a float
	if x is false
		set out equal to the calculation to get the windchill and converts celsius to fahrenheit using cToF
	else
		set out equal to the calculation to get the windchill
		

output function definition
	takes an input of a float d, w, chill, and a boolean x (by value)
	initializes a string temp
	if the boolean x is true
		set temp to be fahrenheit
	else
		set temp to velsius
	return a string containing the final output