Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

COS3711 Assignment 3 2025 (Exceptional Code) Due Year 2025

Beoordeling
-
Verkocht
-
Pagina's
33
Cijfer
A+
Geüpload op
11-09-2025
Geschreven in
2025/2026

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.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

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>;

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
11 september 2025
Aantal pagina's
33
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$4.91
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
LectureLab Teachme2-tutor
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
647
Lid sinds
2 jaar
Aantal volgers
188
Documenten
1450
Laatst verkocht
2 weken geleden
LectureLab

LectureLab: Crafted Clarity for Academic Success Welcome to LectureLab, your go-to source for clear, concise, and expertly crafted lecture notes. Designed to simplify complex topics and boost your grades, our study materials turn lectures into actionable insights. Whether you’re prepping for exams or mastering coursework, LectureLab empowers your learning journey. Explore our resources and ace your studies today!

3.6

83 beoordelingen

5
32
4
16
3
16
2
4
1
15

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen