Extended Task 4

Hi, Jacob Mortimer here from Cats & Dogs Veterinary Surgery.

There was a flood last week, and our computer systems were totally destroyed.

I need you to create a program, using a file, that allows my receptionist to:

  • Add new animals to the file.

  • Search through the file and print the details of a specific animal.

  • Allow a specific animal to be removed from the file.

Vet Surgery

For this task, you will need to create a document and include the following sections (with screenshots where appropriate):

  • An introduction to explain the Purpose of your program.

  • List of Requirements for a successful program.

  • Screenshots of your code (with comments in your code to show understanding).

  • Testing – Create a plan to show how you will test your program and then explanations of any errors that you found and how they were fixed.

  • An Evaluation of what worked, what didn’t, and how you met each of your requirements from your original list. Also, discuss further improvements that you could have made to improve your program.

Reminders for this task:

  • You will need to create a selection of options for the user to choose from. Subroutines and a while true loop may help.
     

  • Section 10 will help you to open, write and read from files.
     

  • Section 10c shows how to edit data in a file. You will need to adapt this code and not write the line that has been selected, instead of writing a modified version of it.
     

  • There are multiple ways to approach this program, and your solution might look different from the example. Break the problem down and focus on one part at a time.

Example solution:

Entering 1 allows the user to enter the details of a new animal which is saved into the file.

Entering 4 will stop the loop and ends the program.

Entering 2 allows the user to enter the details of an animal to search for. If the animal is in the file, their details are printed clearly on a new line.

Entering 3 allows the user to enter the details of an animal to remove from the file. If the animal is in the file, all lines are transferred into a temporary file except for the line to be removed.

© CSNewbs 2020