Class diagram inheritance for animal classification

2025-hsc-se-q22 · Diagram Response · 3 marks

Source: NESA 2025 HSC Software Engineering HSC Q22

Question

An animal classification tool is to be developed. The classes to be used are shown below.

Mammal

Attribute
Colour
Size
Birth type
Number of teeth

Reptile

Attribute
Colour
Size
Scale type
Tongue type

Whale

Attribute
Colour
Size
Birth type
Number of teeth
Blowhole type
Migration location

Dog

Attribute
Colour
Size
Birth type
Number of teeth
Breed
Fur

Construct a class diagram that shows inheritance and removes redundant attributes for each class. Additional classes may be included if required.

You do NOT need to show the nature of the relationships between the classes.

Response

Reveal answer

A suitable class diagram includes:

  • Animal: Colour, Size
  • Mammal inherits from Animal: Birth type, Number of teeth
  • Reptile inherits from Animal: Scale type, Tongue type
  • Whale inherits from Mammal: Blowhole type, Migration location
  • Dog inherits from Mammal: Breed, Fur

Marking rubric

MarksDescription
3Constructs a correct inheritance structure and removes redundant attributes.
2Shows a mostly correct inheritance structure or removes most redundant attributes.
1Shows some understanding of classes, attributes or inheritance.

Explanation

Colour and size can be generalised to an Animal superclass. Mammal-specific attributes can be placed in Mammal, then Whale and Dog only need their own specialised attributes.

Metadata

Submitter
Seed data
Created
2026-05-02
Status
published
Syllabus
y12-project-modelling-tools y12-project-tools-for-ideas-solutions
Tags
class diagrams inheritance OOP redundant attributes