Maintenance

Task 1

A Community Maintenance Officer records damage to local property using a clipboard and pen.

Data entry staff will then record the information digitally.

A computer program stores an array of DamageRecord objects.

Each digital DamageRecord has:

  • an id, an Integer passed as a parameter on construction.
  • a memo, a String describing the damage initialised to None on construction.
  • a date, a String, initialised to the date of entry on construction.

Design the DamageRecord class, including a constructor method and accessor methods for all of the class variables and a mutator method, addMemo, which asks the user to input a description of the damage and assigns it to the memo attribute..

In a computer program we should be able to construct a new DamageRecord as follows:

drec = DamageRecord(1)

Test your design with this program:

drec = DamageRecord(1)

print(drec.getDate())

print(drec.getMemo())

Save your solution as DamageRecord-1.py

Task 2 - A computer program

Design a computer program using the following structure chart:

The following table describes the modules:

module description
Input Choice Enter 1 to add, 2 to search, 0 to quit
Process Choice If choice is 1, call Create module. If choice is 2 call Search module - code an efficient Linear Search
Create Input ID, construct object,append to array
Search Input ID and display memo, or "Not Found" if ID does not exist

Save your solution as DamageRecord-2.py

Task 3 - Adaptive maintenance

You will perform some adaptive maintenance on your program because a new requirement has been identified.

In your computer program, design a new procedure which accepts a date (as a String) as a parameter. The procedure displays all memos in DigitalRecords that have the same date as the parameter.

Save your solution as DamageRecord-3.py

Task 4 - Pseudocode

Write pseudocode for Task 3.

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.