• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 6 fuera de 33 páginas
Examen

COS3711 Assignment 3 2025 (Exceptional Code) Due Year 2025

Document preview thumbnail
Vista previa 6 fuera de 33 páginas

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.

Vista previa del contenido

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

Libro relacionado
 image
W. Richard Stevens, Stephen A. Rago Advanced Programming in the UNIX Environment
Editorial: 2013 ISBN: 9780321637734 Edición: Desconocido

Información del documento

Subido en
11 de septiembre de 2025
Número de páginas
33
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$4.91

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
LectureLab
3.6
(91)
Vendido
719
Seguidores
188
Artículos
1594
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes