The City of Atlanta is holding a special census. The census
takers collect one record for each resident. Each record contains a
resident’s age, gender, and voting district. The voting district
field contains a value between 1 and 22. The program will accept
resident information until a sentinel value is entered. At the end,
the program will produce a list of districts and the count for each
district. Given the following pseudocode, fill in the missing lines
of code:
(Grading: 20 points)
class districtCensusProgram
class DistrictReport
main()
// Declarations
num district
num DIS_SIZE = 22
num districtCnt[SIZE] = 0
num QUIT = -1
output “Enter a district number or ”, QUIT, “ to quit”
input district
while district <> QUIT
a. if
b.
c.
else
output “Invalid district, record not counted”
endif
output “Enter a district number or ”, QUIT, “ to quit”
input district
endwhile
district = 0
d. while
output district+1, districtCnt[district]
e. district =
endwhile
return
endClass
//pseudo code class districtCensusProgram |
Screen shot of the pseudo code |
Please comment if any query
Get Answers For Free
Most questions answered within 1 hours.