Assignment 2 2025
Unique number:
Due Date: 18 July 2025
Project Structure Overview
You’ll need two separate folders/projects:
COS3711_Assignment2/
│
├── store_app/ <- Project 1: Store application
│ ├── CMakeLists.txt
│ ├── main.cpp
│ ├── MainWindow.h/.cpp
│ ├── Customer.h/.cpp
│ ├── Item.h/.cpp
│ ├── Transaction.h/.cpp
│ └── ...
│
├── udp_receiver/ <- Project 2: UDP listener app
│ ├── CMakeLists.txt
│ ├── main.cpp
│ ├── MainWindow.h/.cpp
│ └── ...
Terms of use
By making use of this document you agree to:
Use this document as a guide for learning, comparison and reference purpose,
Terms of use
Not to duplicate, reproduce and/or misrepresent the contents of this document as your own work,
By making use of this document you agree to:
Use this document
Fully accept the consequences
solely as a guide forshould you plagiarise
learning, reference,or and
misuse this document.
comparison purposes,
Ensure originality of your own work, and fully accept the consequences should you plagiarise or misuse this document.
Comply with all relevant standards, guidelines, regulations, and legislation governing academic and written work.
Disclaimer
Great care has been taken in the preparation of this document; however, the contents are provided "as is" without any express or
implied representations or warranties. The author accepts no responsibility or liability for any actions taken based on the
information contained within this document. This document is intended solely for comparison, research, and reference purposes.
Reproduction, resale, or transmission of any part of this document, in any form or by any means, is strictly prohibited.
, +27 67 171 1739
Project Structure Overview
You’ll need two separate folders/projects:
COS3711_Assignment2/
│
├── store_app/ <- Project 1: Store application
│ ├── CMakeLists.txt
│ ├── main.cpp
│ ├── MainWindow.h/.cpp
│ ├── Customer.h/.cpp
│ ├── Item.h/.cpp
│ ├── Transaction.h/.cpp
│ └── ...
│
├── udp_receiver/ <- Project 2: UDP listener app
│ ├── CMakeLists.txt
│ ├── main.cpp
│ ├── MainWindow.h/.cpp
│ └── ...
1. Starter Code – store_app
✅CMakeLists.txt
cmake
CopyEdit
cmake_minimum_required(VERSION 3.5)
project(store_app)
set(CMAKE_CXX_STANDARD 17)
find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED)
add_executable(store_app
main.cpp
MainWindow.cpp MainWindow.h
Customer.cpp Customer.h
Item.cpp Item.h
Transaction.cpp Transaction.h
)
target_link_libraries(store_app Qt5::Core Qt5::Widgets Qt5::Network)
✅main.cpp
cpp
CopyEdit
#include <QApplication>
#include "MainWindow.h"
Disclaimer
Great care has been taken in the preparation of this document; however, the contents are provided "as is"
without any express or implied representations or warranties. The author accepts no responsibility or
liability for any actions taken based on the information contained within this document. This document is
intended solely for comparison, research, and reference purposes. Reproduction, resale, or transmission
of any part of this document, in any form or by any means, is strictly prohibited.
, +27 67 171 1739
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
MainWindow w;
w.show();
return app.exec();
}
✅MainWindow.h
cpp
CopyEdit
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTreeView>
#include <QStandardItemModel>
#include <QUdpSocket>
#include <QPushButton>
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void onBroadcastClicked();
private:
QStandardItemModel *transactionModel;
QPushButton *broadcastButton;
void setupUI();
void populateDummyData();
};
#endif // MAINWINDOW_H
✅MainWindow.cpp
cpp
CopyEdit
#include "MainWindow.h"
#include <QVBoxLayout>
#include <QTreeView>
#include <QXmlStreamWriter>
#include <QByteArray>
#include <QThread>
#include <QUdpSocket>
#include <QPushButton>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
transactionModel(new QStandardItemModel(this))
{
Disclaimer
Great care has been taken in the preparation of this document; however, the contents are provided "as is"
without any express or implied representations or warranties. The author accepts no responsibility or
liability for any actions taken based on the information contained within this document. This document is
intended solely for comparison, research, and reference purposes. Reproduction, resale, or transmission
of any part of this document, in any form or by any means, is strictly prohibited.