Question

The City of Atlanta is holding a special census. The census takers collect one record for...

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

Homework Answers

Answer #1

//pseudo code

class districtCensusProgram
class DistrictReport
main()
// Declarations
   num district
   num DIS_SIZE = 22
   num districtCnt[DIS_SIZE] = 0
   num QUIT = -1
   output “Enter a district number or ”, QUIT, “ to quit”
   input district
   while district <> QUIT
       a. ifdistrict > 0 and district < = DIS_SIZE
               c. districtCnt[district] = districtCnt[district] + 1
       else
           output “Invalid district, record not counted”
       endif
       output “Enter a district number or ”, QUIT, “ to quit”
       input district
   endwhile
   district = 1
   d. while district <= DIS_SIZE
       output district+1, districtCnt[district]
       e. district = district + 1
   endwhile
   return
endClass

Screen shot of the pseudo code

Please comment if any query

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The assignment below has three pseudocodes below I need to fix the debug exercises in it....
The assignment below has three pseudocodes below I need to fix the debug exercises in it. Please help. Thanks. Highlight or mark in bold the corrections. Thanks! //DEBUG06-01 // A high school is holding a recycling competition, // and this program allows a user to enter a student's // year in school (1 through 4) and number of cans collected // for recycling. Data is entered continuously until the user // enters 9 for the year. // After headings, output...
I'm currently stuck on Level 3 for the following assignment. When passing my program through testing...
I'm currently stuck on Level 3 for the following assignment. When passing my program through testing associated with the assignment it is failing one part of testing.   Below is the test that fails: Failed test 4: differences in output arguments: -c input data: a b c -c expected stdout: b observed stdout: a b expected stderr: observed stderr: ./test: invalid option -- 'c' Unsure where I have gone wrong. MUST BE WRITTEN IN C++ Task Level 1: Basic operation Complete...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the...
Can someone please edit my code so that it satisfies the assignments' requirements? I pasted the codes below. Requirement: Goals for This Project:  Using class to model Abstract Data Type  OOP-Data Encapsulation You are asked to write an app to keep track of a relatively small music library. The app should load song information from a data file once the app is started. It should allow user to view, add, remove, and search for songs. The app should...