, COS3711 Assignment 5
Semester 2 2025
DUE 2025
Use this document as a guide and for references to answer your assignment
A — Design / UML (textual)
Notation: -> means "has-a / uses". Abstract classes are marked (abstract). I
name methods and important attributes.
Key classes (high level)
1. Container (abstract)
o attrs: QString code, double weight, int volume
o methods: virtual int calcVolume() = 0; virtual
QDomElement toXml(QDomDocument &doc) const = 0;
virtual QString typeName() const = 0;
o notes: cannot be instantiated.
2. Box : Container
o attrs: int length, breadth, height
o methods: override calcVolume(), toXml, typeName() returns
"Box"
3. Cylinder : Container
o attrs: int diameter, height
o methods: override calcVolume(), toXml, typeName() returns
"Cylinder"
4. ContainerFactory (Factory pattern)
o static method: Container* create(ContainerType type,
params...)
o responsibilities: generate container instance and allocate unique code
(YYYY/MM/[B|C]serial)
5. CodeGenerator
o responsibilities: produce codes according to spec:
YYYY/MM/{B|C}<serial>, serial per (year,month,type)
o used by ContainerFactory
Semester 2 2025
DUE 2025
Use this document as a guide and for references to answer your assignment
A — Design / UML (textual)
Notation: -> means "has-a / uses". Abstract classes are marked (abstract). I
name methods and important attributes.
Key classes (high level)
1. Container (abstract)
o attrs: QString code, double weight, int volume
o methods: virtual int calcVolume() = 0; virtual
QDomElement toXml(QDomDocument &doc) const = 0;
virtual QString typeName() const = 0;
o notes: cannot be instantiated.
2. Box : Container
o attrs: int length, breadth, height
o methods: override calcVolume(), toXml, typeName() returns
"Box"
3. Cylinder : Container
o attrs: int diameter, height
o methods: override calcVolume(), toXml, typeName() returns
"Cylinder"
4. ContainerFactory (Factory pattern)
o static method: Container* create(ContainerType type,
params...)
o responsibilities: generate container instance and allocate unique code
(YYYY/MM/[B|C]serial)
5. CodeGenerator
o responsibilities: produce codes according to spec:
YYYY/MM/{B|C}<serial>, serial per (year,month,type)
o used by ContainerFactory