-
Notifications
You must be signed in to change notification settings - Fork 0
/
Batting_Averages
45 lines (45 loc) · 1.22 KB
/
Batting_Averages
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
start
Declarations
num battingAverage
string promptJersey = "Please enter the jersey number."
num hitNumber
num jerseyNumber
num atBats
string promptHits = "Please enter the players hits."
string promptBats = "Please enter the players at bats."
string displayEnd = "End of job"
string excellentHitter = "excellent hitter"
housekeeping()
while jerseyNumber != 0
calculatebattingaverage()
housekeeping()
endwhile
endofjob()
stop
//Collects inputs and prompts users.
housekeeping()
output promptJersey
input jerseyNumber
output promptHits
input hitNumber
output promptBats
input atBats
return
//Calculates batting average, compares batting average to if/else statement and outputs results.
calculatebattingaverage()
set battingAverage = hitNumber / atBats
if battingAverage is > .400 then
output excellentHitter
output jerseyNumber
output battingAverage
output atBats
output hitNumber
else
output jerseyNumber
output battingAverage
endif
return
//Wraps everything up.
endofjob()
output displayEnd
return