A veterinary surgery wants to create a class for individual pets. Some of the attributes required in the class are listed in the table. [Figure X.X - table]
- (a)State one reason why the attributes would be declared as PRIVATE.[1]
- (b)Complete the class diagram for Pet, to include: • an attribute and data type for the name of the pet • an attribute and data type for the name of the owner • a method to create a Pet object and set attributes at the time of registration • a method to assign a pet ID • a method to assign the date of registration • a method to return the pet name • a method to return the owner's telephone number. [Figure X.X - class diagram template][5]
This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2024). The mark or mark type is shown in brackets.
- 9(a) To ensure that the attributes are only accessible using the class's own methods/within the class.
- 9(b) One mark per mark point (Max 5)
- 9(b) MP1 Two correct attributes with sensible names and correct data types.
- 9(b) MP2 Constructor present.
- 9(b) MP3 Two correct setters with exact names and appropriate parameters and data types.
- 9(b) MP4 Two correct getters with appropriate names.
- 9(b) MP5 Name assigned to pet name getter matches the attribute.
- 9(b) Pet PetID : STRING PetType : STRING OwnerTelephone : STRING DateRegistered : DATE PetName : STRING OwnerName : STRING Constructor() SetPetID(APetID : STRING) SetDateRegistered(RegDate : DATE) GetPetName() GetOwnerTelephone()
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →