Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 6 out of 33 pages
Exam (elaborations)

COS3711 Assignment 3 2025 (Exceptional Code) Due Year 2025

Document preview thumbnail
Preview 6 out of 33 pages

DISTINCTION GUARANTEED This 100% exam-ready assignment offers expertly verified answers, comprehensive explanations, and credible academic references—meticulously developed to ensure a clear understanding of every concept. Designed with clarity, precision, and academic integrity, this fully solved resource is your key to mastering the subject and excelling in your assessments.

Content preview

COS3711
Assignment 3
Due Year 2025

,COS3711: Advanced Programming

Assignment 3 2025



Table of Contents

1. Summary of Objectives

2. Design Overview (Classes, Relationships, Patterns)

3. Source-Code Structure and CMake Outline

4. Class Skeletons (Headers + Comments)

Container hierarchy (abstract base, Box, Cylinder)

ContainerFactory (Factory Method)

Pallet and PalletManager

Memento for backup/restore

Models for Qt (Unallocated list, Pallet model)

5. GUI Skeleton (QMainWindow, Tabs, Widgets, Actions)

6. XML Serialization (QXmlStreamWriter) and Parsing (DOM/QXmlStreamReader)

7. Threaded Serialization Worker and TCP Client (Send XML)

8. TCP Server (Separate Project) — Listen, Parse, Validate, Update Model/View

9. Notes on Memory Management, Validation, and Testing

10. Minimal CMakeLists.txt Examples

11. Critical Justification and Theoretical Alignment

12. Example Scenarios and Expected Behaviours

13. Limitations and Enhancements

14. Final Checklist for Submission

15. References

,1. Summary of Objectives

The system must:

• Model containers (Box, Cylinder) with codes, weights, and computed integer
volumes.

• Prevent instantiation of the abstract base Container.

• Display unallocated containers using Qt’s model/view architecture.

• Allow containers to be moved onto pallets, each identified by an arbitrary
number.

• Provide in-memory backup and restore of unallocated containers using
snapshots (not raw pointers).

• Serialize pallets to XML, transmit them to a TCP server (127.0.0.1:6164) in a
worker thread, and display the XML in the GUI.

• Implement a separate TCP server that receives XML, validates container codes
via regex, substitutes **** for invalid codes, and displays parsed container data in
a Qt model/view.



2. Design Overview

Core Classes and Responsibilities

• Container (abstract): Holds code, weight, and declares volume() and toXml().

• Box, Cylinder: Compute volumes and implement serialization.

• ContainerFactory: Generates valid codes and instantiates concrete containers.

• Pallet: Aggregates containers; computes totals.

• PalletManager: Maps pallet numbers to Pallet objects; serializes all pallets.

• Memento / BackupManager: Captures snapshots of unallocated containers for
restoration.

, • ContainerListModel (QAbstractListModel): Represents unallocated container
codes.

• PalletModel (QStandardItemModel): Displays pallets and contents.

• MainWindow: Provides GUI, menus, toolbar, and tabbed interface.

• XmlSerializerWorker: Runs in a QThread, produces XML, sends via TCP.

• TcpSender: Client utility to deliver XML to 127.0.0.1:6164.

• TcpServerApp: Separate Qt app that receives XML, validates codes, and
updates model.

Design Patterns Applied

• Factory Method: For container creation and code generation.

• Memento: For backup and restore of unallocated containers.

• Model/View: Qt’s architecture for separating data and presentation.

• Observer (Qt signals/slots): To keep GUI responsive and reactive.

• RAII and smart pointers: For safe memory management.

• Worker thread: For non-blocking serialization and TCP transmission.

,3. Source-code layout

COS3711_A3/
├─ app/ # main application (GUI)
│ ├─ include/
│ │ ├─ container.h
│ │ ├─ box.h
│ │ ├─ cylinder.h
│ │ ├─ containerfactory.h
│ │ ├─ pallet.h
│ │ ├─ palletmanager.h
│ │ ├─ memento.h
│ │ ├─ containerlistmodel.h
│ │ ├─ xmlserializerworker.h
│ │ └─ tcpsender.h
│ ├─ src/
│ │ └─ *.cpp
│ ├─ resources/ (icons)
│ └─ CMakeLists.txt
├─ server/ # TCP server project
│ ├─ src/
│ └─ CMakeLists.txt
└─ CMakeLists.txt

, 4. Class skeletons and brief explanation

4.1 container.h (abstract base)



// include/container.h
#pragma once

#include <QString>
#include <QXmlStreamWriter>
#include <memory>

class Container {
public:
explicit Container(QString code, double weight)
: m_code(std::move(code)), m_weight(weight) {}
virtual ~Container() = default;

QString code() const { return m_code; }
double weight() const { return m_weight; }
void setWeight(double w) { m_weight = w; }

// volume must be integer per spec; return as integer
virtual int volume() const = 0;
virtual void toXml(QXmlStreamWriter& writer) const = 0;

protected:
QString m_code;
double m_weight;
};
using ContainerPtr = std::unique_ptr<Container>;

Connected book
 image
W. Richard Stevens, Stephen A. Rago Advanced Programming in the UNIX Environment
Publisher: 2013 ISBN: 9780321637734 Edition: Unknown

Document information

Uploaded on
September 11, 2025
Number of pages
33
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
R80,74

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
LectureLab
3,6
(86)
Sold
689
Followers
188
Items
1561
Last sold
3 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions