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...
debug the following 1) // The main program calls a method that // prompts for and...
debug the following 1) // The main program calls a method that // prompts for and returns a name start Declarations string usersName name = askUserForName() output "Your name is ", usersName stop string askUserForName() Declarations string name output "Please type your name " input usersName return 2) // The main program passes a user’s entry to // a method that displays a multiplication table // using the entered value. The table includes the // value multiplied by every factor...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT