100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

COS3711 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025; 100% correct solutions and explanations.

Puntuación
-
Vendido
-
Páginas
26
Grado
A+
Subido en
12-09-2025
Escrito en
2025/2026

COS3711 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025; 100% correct solutions and explanations. Assignment 3 1. Introduction Please read this whole assignment tutorial letter before starting to ensure that you know what is expected of you and you do not get surprised by some requirement later in the development process. Please note that you must not use Qt Designer, and you are expected to manually set up GUIs to ensure that you properly handle memory using Qt’s parent-child functionality. Three sets of files have been provided for you so that you do not have to do it all from scratch: • COS3711A3_QMainWindow_template – use this template to set up the main GUIs. • COS3711A3_ContainerWidget – this contains a widget providing the setup of the one interface. • COS3711A3_Icons – this contains icons that you can use in the application. Use these to set up a project (using cmake, not qmake) that uses a QMainWindow as the user interface so that you can implement the functionality provided by a QMainWindow (menus, toolbar, status bar) to meet the requirements of the scenario given below. Marks will also be awarded for following good programming practice, for example, • naming conventions, • code layout and line spacing, • using initialiser lists in constructors, • using forward class declarations in header files, • enabling and disabling buttons as appropriate, • GUI handling like setting focus, sequential tabbing, clearing input widgets (like text input fields being cleared and spin boxes being returned to some default value), and • providing appropriate user feedback (including tooltips and messages to the user). Your code should build and run without any warnings. Consider the following scenario and then design a solution to meet the requirements listed. 2. Scenario Transporting cargo around the world is essential in ensuring that customers have access to the goods they need and want. Containers All such items are packaged in some sort of container, each of which has a code, weight, and volume (which should be calculated and expressed as an integer). For the purposes of this scenario, there are two kinds of containers. • A box, where we want to know its dimensions: length, breadth, and height. • A cylinder, where we want to know its diameter and height. The user should not be able to instantiate a simple container; only boxes and cylinders can be instantiated. Think carefully about how these requirements will be designed and an appropriate design pattern that could be used when instantiating container types. Use sensible ranges/limits for the input widgets on the user interface. The container code, which is allocated when containers are created, takes the following format. • The current year value between 2000 and 2099 (both included) • Forward slash (/) • The current month value between 01 and 12 (both included) • Forward slash (/) • A ‘B’ or a ‘C’, depending on the container type. • A serial number starting from 1, running up to 9999. Each new container is given the next serial number. Examples of valid codes are 2022/01/B1 and 2022/01/C2. Lists When a user creates a box or cylinder, the objects should be added to an unallocated container list. The container codes of these items should be displayed on the user interface using some model/view convenience class instance. The user should be able to backup this list of unallocated containers (remembering that you cannot simply back up the pointers to the container objects as they may be deleted before the restore is done); when restoring the unallocated container list, the container objects should be recreated and added to the list, and the model/view convenience object appropriately updated. Use an appropriate design pattern for this backup/restore functionality where the state is saved in memory rather than to a file. For transport, containers are packed onto a pallet (where it should be possible to calculate a pallet’s total weight and volume); for the purposes of this assignment, you may assume that there is no limit to the number of pallets, number of items on a pallet, or a pallet’s total weight and volume. The user should be able to click on a container code in the model/view convenience object, and this container should be moved to a pallet selected by the user, updating both the list of unallocated containers and the model/view convenience display. This means that there should also be a list of pallets, where pallets can be identified by a pallet number (which do not have to be sequential; a user can load containers onto pallets numbered 1 and 3 without loading any containers onto pallet 2). Here is the required design of the user interface, showing how it could be used. As can be seen, all this functionality is available on one tab of the user interface. Serialising The user should be able to serialise the list of pallets. This is achieved on a second tab on the user interface. • The serialising task should be run in a thread. • The pallet list should be

Mostrar más Leer menos
Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Libro relacionado

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
12 de septiembre de 2025
Número de páginas
26
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

, COS3711 Assignment 3 (COMPLETE ANSWERS) 2025 -
DUE 2025; 100% correct solutions and explanations.

Design + implementation plan (complete,
ready-to-code)
Below I will give a concrete, practical solution you can implement straight away: class design,
GUI layout, CMake, key C++/Qt code snippets (container classes, factory, memento-style in-
memory backup/restore, pallet model, XML serialization on a worker thread, TCP client send,
and a simple TCP server). I focus on exactly the behaviours your brief requires and on good
Qt/C++ practice (pointers, parent-child ownership, initializer lists, forward declarations,
signals/slots, models for views). Use/extend these files to finish your project.




1 — High-level architecture & patterns
 Container (abstract) — base class (code, weight, volume as int) — pure virtual
toXml(QXmlStreamWriter&) and type() etc. Concrete: Box, Cylinder.
o Factory pattern to create Box/Cylinder instances (prevents creating raw Container).
 ContainerCodeGenerator — generates codes of the form YYYY/MM/[B|C]<serial>; keeps
a map of serial counters per YYYY/MM/B or per type; ensures serials 1..9999.
 Unallocated list — QStandardItemModel (so it can be shown in QListView/QTreeView).
Items hold QVariant::fromValue(Container*) or store container info; but because we must
manage pointers, keep std::unique_ptr/raw pointers in an app-level container list and store
code string in the model. (The brief asks pointers used for all instances — so classes will
be created with new and parented where appropriate.)
 Backup/Restore — Memento pattern in memory: store a deep-copy
std::vector<std::unique_ptr<Container>> snapshot (or store serializable state objects). On
restore, clear current unallocated list and recreate containers from the snapshot.
IMPORTANT: do not back up pointers only.
 Pallet — class with number, QList<Container*> (pointers), weight() and volume() calculations.
Pallets are stored in an application-level QList<Pallet*> (or std::vector<Pallet*>).
 Serialization worker — QObject moved to QThread (or use QRunnable + QThreadPool).
Worker builds XML using QXmlStreamWriter and emits a xmlReady(QString) signal; it will
also send the XML to 127.0.0.1:6164 via QTcpSocket (connect->write->flush->close).
 Server — separate Qt console project using QTcpServer. On message received, parse
XML using QXmlStreamReader, validate container codes via QRegularExpression, replace
invalid codes with ****, and update a model (e.g., QStandardItemModel) for a view.

Design patterns used: Factory, Memento (for backup/restore), MVC (Qt model/view), Worker
Thread.
$2.77
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor

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.
MasterVincent University of South Africa (Unisa)
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
2565
Miembro desde
2 año
Número de seguidores
452
Documentos
1529
Última venta
21 horas hace
MasterVincent

On this page, you find all documents, package deals, and flashcards offered by seller MasterVincent.

4.1

376 reseñas

5
205
4
68
3
51
2
24
1
28

Recientemente visto por ti

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