,COS3711 Assignment 3 (COMPLETE ANSWERS)
Semester 2 2025 - DUE 2025; 100% TRUSTED
Complete, trusted solutions and explanations.
I’ll give you both: (A) a clear class/UML design for the assignment and
(B) a runnable C++/Qt project skeleton (CMake) with the key classes
and glue code you’ll need. I’ll include concrete headers/implementation
skeletons you can paste into files and extend.
I won’t overload with every single UI widget line-by-line (that would be
huge), but I provide the full architecture, model classes,
thread/serialization worker, TCP client & server, and a solid
QMainWindow skeleton wired into the models — enough to compile,
run and continue building UI logic.
1) High-level design / UML (textual)
Use these design patterns:
Factory: to create Box/Cylinder and produce the correct code
(B/C).
Memento: backup/restore of the unallocated container list (storing
cloned container state in memory).
Model/View: QAbstractListModel or
QStringListModel for unallocated list;
QAbstractTableModel or QStandardItemModel for
server display.
Worker Thread: SerializationWorker (QRunnable or
QObject moved to QThread) to build XML and send to TCP
server.
Observer / Signals: model updates notify UI.
, UML (textual):
QObject
└─ Container (abstract, QObject)
+QString code
+double weight
+int volume()
+virtual void toXml(QXmlStreamWriter&) = 0
+virtual Container* clone() const = 0
Container <- Box (QObject)
+double length, breadth, height
Container <- Cylinder (QObject)
+double diameter, height
ContainerFactory
+static Container* createBox(...)
+static Container* createCylinder(...)
Pallet (QObject)
+int number
+QList<Container*> containers
+double totalWeight()
+int totalVolume()
PalletManager (QObject)
+QMap<int, Pallet*> pallets
UnallocatedListModel : QAbstractListModel
holds QList<Container*>
Memento
+QVector<QByteArray> serializedContainers
SerializationWorker : QObject
+signals: xmlReady(QString), finished(bool)
+slots: start()
TcpClientSender : uses QTcpSocket to send XML to 127.0.0.1:6164
ServerApp (separate project)
- QTcpServer, accepts incoming XML, parse with QXmlStreamReader,
fill QStandardItemModel (display in QTreeView)
Semester 2 2025 - DUE 2025; 100% TRUSTED
Complete, trusted solutions and explanations.
I’ll give you both: (A) a clear class/UML design for the assignment and
(B) a runnable C++/Qt project skeleton (CMake) with the key classes
and glue code you’ll need. I’ll include concrete headers/implementation
skeletons you can paste into files and extend.
I won’t overload with every single UI widget line-by-line (that would be
huge), but I provide the full architecture, model classes,
thread/serialization worker, TCP client & server, and a solid
QMainWindow skeleton wired into the models — enough to compile,
run and continue building UI logic.
1) High-level design / UML (textual)
Use these design patterns:
Factory: to create Box/Cylinder and produce the correct code
(B/C).
Memento: backup/restore of the unallocated container list (storing
cloned container state in memory).
Model/View: QAbstractListModel or
QStringListModel for unallocated list;
QAbstractTableModel or QStandardItemModel for
server display.
Worker Thread: SerializationWorker (QRunnable or
QObject moved to QThread) to build XML and send to TCP
server.
Observer / Signals: model updates notify UI.
, UML (textual):
QObject
└─ Container (abstract, QObject)
+QString code
+double weight
+int volume()
+virtual void toXml(QXmlStreamWriter&) = 0
+virtual Container* clone() const = 0
Container <- Box (QObject)
+double length, breadth, height
Container <- Cylinder (QObject)
+double diameter, height
ContainerFactory
+static Container* createBox(...)
+static Container* createCylinder(...)
Pallet (QObject)
+int number
+QList<Container*> containers
+double totalWeight()
+int totalVolume()
PalletManager (QObject)
+QMap<int, Pallet*> pallets
UnallocatedListModel : QAbstractListModel
holds QList<Container*>
Memento
+QVector<QByteArray> serializedContainers
SerializationWorker : QObject
+signals: xmlReady(QString), finished(bool)
+slots: start()
TcpClientSender : uses QTcpSocket to send XML to 127.0.0.1:6164
ServerApp (separate project)
- QTcpServer, accepts incoming XML, parse with QXmlStreamReader,
fill QStandardItemModel (display in QTreeView)