The Census

Task 1

A town official has organised a taskforce of workers to go out into the community and count the number of people living at each street address.

Each task force worker will visit up to 500 street addresses.

Each time a taskforce worker knocks on a door, the following questions are asked:

  • How many people live in this house? The number is entered into a computer system.
  • Do school-children live in this house? If the answer is yes, a count is incremented in the computer system.

Create a computer program that will allow a taskforce worker to enter the data above.

It should be menu-driven eg:

  1. Press 1 to enter number of people
  2. Press 2 to update school-children count.
  3. Press 3 to QUIT!

Use an array to store the answers to the first question.

Note: the system will reject any input that is unreasonable and ask the worker to reenter the data.

When the program has finished it will output:

  • the total number of people entered
  • the greatest number entered eg 6
  • the count of houses with school children

Use Python's input() function or a random number generator to simulate the entry of the number of people in a house.

Task 2 - Pseudocode

Research pseudocode used in this course and try to translate your solution into pseudocode.

Task 3 - screencasting

Create a screencast for your portfolio. Describe how your code works and run the program to show your audience.

Recommended software is screencastomatic.

poor sound quality but worth a watch!

suggested solution

Testing

Make sure you are thoughtful when testing your solution.

If your code has a validation check, test your code with acceptable/valid data and unacceptable/invalid data.