100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

COS3711 Assignment 2 solution 2025

Rating
5,0
(1)
Sold
1
Pages
24
Uploaded on
15-07-2025
Written in
2024/2025

COS3711/Assignment 3/2023 1 Assignment Tutorial Letter 2023 Advanced Programming COS3711 Year module Computer Science Department Assignment 3 Question BARCODE COS3711/Assignment 3/2023 2 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. Use CMake to set up the projects and use QMainWindow instances for the user interfaces so that you can implement the functionality provided by a QMainWindow (such as menus, a toolbar, and a status bar) to meet the requirements of the scenario given below. 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. Marks will also be awarded for following good programming practice. • Follow standard naming conventions: class names start with a capital letter, variable and function names start with a lowercase letter, using camelCase for names made up of multiple words. • Ensure consistent code layout and use of blank lines. • Use forward class declarations in header files. • Use initialiser lists in constructors. • Have proper GUI management: setting cursor focus, sequential tabbing, clearing input widgets (like text input fields being cleared and spin boxes being returned to some default value), and enabling and disabling buttons/menu items as appropriate. • Provide appropriate user feedback. • 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 Implement an application that tracks items bought from a store. Screenshots of possible interfaces have been provided as guidance below. Store application The store keeps a list of customers so that when something is purchased from the store, it is recorded against that customer’s name. Only the customer’s name is required. Only two items are currently sold in the store currently – books and magazines, and only the name of the item is required. Clearly, a list of such items is needed, and the user should be able to add items to the list. When an item is added, the application should automatically make a backup in COS3711/Assignment 3/2023 3 memory in case something goes wrong when the application is being used. Provision should thus be made to restore this list when necessary. Clearly, for the sake of data integrity, you do not want the user to create multiple copies of these lists. When a customer purchases items, a transaction is recorded. The date/time of the purchase is noted, as is the name, type, and quantity of each item purchased as part of the transaction. Use an appropriate widget to indicate which items have already been added as part of this transaction. All transactions should be displayed on the main GUI. A tree model (and appropriate view) should be used so that a user can see a customer’s transactions grouped together. COS3711/Assignment 3/2023 4 The user should be able to broadcast (using UDP) the contents of the model in XML format. This task should be run as a thread in the main application. The required XML format can be seen in the image in the next section. UDP receiver application Create a separate application that simply listens for the broadcast message and displays the received data (in XML format) on the GUI. 3. Requirements The following general requirements should be noted. • Follow good OOP design principles. • You should use menus in your application. • Pointers should be used for all instances of objects, and memory should be properly managed. • Appropriate design patterns should be used where sensible. 4. Extras Bonus marks will be awarded for the following. • The data members required for the classes are very basic and can be extended (like adding a price for each item and tracking the number of items available). COS3711/Assignment 3/2023 5 • Using QMainWindow functionality: o Splash screen o Application icon o Toolbar o About and Help 5. Submission Please check the How to submit the assessments page in the Module orientation lesson on myUnisa before submitting this assignment for information about how to submit the assignment. • Use CMake when setting up your assignment. • Submit only the project folders. • You should not submit the build-desktop folders. • Zip the two folders (for the two parts of the project) into one zipped file for submission. © Unisa 2023

Show more Read less














Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
July 15, 2025
Number of pages
24
Written in
2024/2025
Type
Other
Person
Unknown

Subjects

Content preview

COS3711 ASSIGNMENT 2 2025
BOTH SOLUTIONS




This project is ready, but you can edit to meet your requirements.

The full code link is attached in this file

,Application Outputs
Splash screen




Landing page - Item and customer Management

,Second tab - Transaction Management view

,After Broadcasting

,Source code:

item.h
#ifndef ITEM_H
#define ITEM_H


#include <QString>
#include <QObject>


class Item {
public:
explicit Item(const QString& name, const QString& type, double price =
0.0, int stock = 0, QObject* parent = nullptr);


QString getName() const;
QString getType() const;
double getPrice() const;
int getStock() const;


private:
QString name;
QString type;
double price;
int stock;
QObject* parent;
};


#endif // ITEM_H




item.cpp
#include "item.h"


Item::Item(const QString& name, const QString& type, double price, int
stock, QObject* parent)
: name(name), type(type), price(price), stock(stock), parent(parent) {
}


QString Item::getName() const {

, return name;
}


QString Item::getType() const {
return type;
}


double Item::getPrice() const {
return price;
}


int Item::getStock() const {
return stock;
}




customer.h
#ifndef CUSTOMER_H
#define CUSTOMER_H


#include <QString>
#include <QObject>


class Customer {
public:
explicit Customer(const QString& name, QObject* parent = nullptr);
QString getName() const;


private:
QString name;
QObject* parent;
};


#endif // CUSTOMER_H




customer.cpp
#include "customer.h"

, Customer::Customer(const QString& name, QObject* parent)
: name(name), parent(parent) {
}


QString Customer::getName() const {
return name;
}




backupmanager.h
#ifndef BACKUPMANAGER_H
#define BACKUPMANAGER_H


#include <QObject>
#include <QList>
#include "customer.h"


class BackupManager : public QObject {
Q_OBJECT


public:
static BackupManager* instance(QObject* parent = nullptr);


void backupCustomers(const QList<Customer*>& customers);
QList<Customer*> restoreCustomers();


private:
explicit BackupManager(QObject* parent = nullptr);
QList<Customer*> backupCustomersList;
};


#endif // BACKUPMANAGER_H




backupmanager.cpp
#include "backupmanager.h"


BackupManager* BackupManager::instance(QObject* parent) {

Reviews from verified buyers

Showing all reviews
3 months ago

5,0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
CrystalIndigo University of South Africa (Unisa)
View profile
Follow You need to be logged in order to follow users or courses
Sold
486
Member since
5 year
Number of followers
226
Documents
73
Last sold
2 months ago
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 reviews

5
27
4
13
3
6
2
1
1
4

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions