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
│ └── ...
DISCLAIMER & TERMS OF USE
Educational Aid: These study notes are intended to be used as educational resources and should not be seen as a
replacement for individual research, critical analysis, or professional consultation. Students are encouraged to perform
their own research and seek advice from their instructors or academic advisors for specific assignment guidelines.
Personal Responsibility: While every effort has been made to ensure the accuracy and reliability of the information in
these study notes, the seller does not guarantee the completeness or correctness of all content. The buyer is
responsible for verifying the accuracy of the information and exercising their own judgment when applying it to their
assignments.
Academic Integrity: It is essential for students to maintain academic integrity and follow their institution's policies
regarding plagiarism, citation, and referencing. These study notes should be used as learning tools and sources of
inspiration. Any direct reproduction of the content without proper citation and acknowledgment may be considered
academic misconduct.
Limited Liability: The seller shall not be liable for any direct or indirect damages, losses, or consequences arising from
the use of these notes. This includes, but is not limited to, poor academic performance, penalties, or any other negative
consequences resulting from the application or misuse of the information provided.
, For additional support +27 81 278 3372
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"
, For additional support +27 81 278 3372
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))
{