Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 23 pages
Exam (elaborations)

COS3711 Assigment 3 Year Module Due 2026

Document preview thumbnail
Preview 3 out of 23 pages

Comprehensive Study Material; Expert Verified & Exam-Ready This assignment package has been carefully developed to support serious academic preparation. Each solution is thoroughly researched, clearly explained, and backed by credible references giving you not just the answers, but a genuine understanding of the underlying concepts. The material is structured for clarity, making even complex topics approachable without sacrificing depth or accuracy. Whether you're consolidating your knowledge or preparing under time pressure, these resources are designed to help you walk into any exam with confidence.

Content preview

UNIVERSITY OF SOUTH AFRICA
College of Science, Engineering and Technology


⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄


COS3711: Advanced Programming

Assignment 3 — 2026

⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄ ⋄⋄




COS3711
Module Code:
Advanced Programming
Module Name:
Assignment 3
Assignment:
2026
Year:




Submitted in partial fulfilment of the require-
ments for Advanced Programming — UNISA 2026

, UNISA | COS3711 Advanced Programming – Assignment 3



Question 1: GetStudent – GUI with Input Masks and Regular Expression Validation

The GetStudent application is a standalone Qt GUI program that collects a student number,
module code, and mark from the user. Input masks provide first-level formatting guidance,
while QRegularExpression validators enforce the exact rules specified in the assignment.
On submission, the data is printed to standard output so that a parent process can read it in
Question 2 (Blanchette and Summerfield, 2008).


1.1 Validation Rules


The three fields and their rules are:

Table 1: Input validation rules for GetStudent
Field Rule Regex Pattern
Student Number Exactly 4 digits ^[0-9]{4}$
Module Code 3 uppercase letters, then 1/2/3, ^[A-Z]{3}[123][0-9]{2}[A-Za-z0-9]$
then 2 digits, then 1 alphanumeric
Mark Integer 0 to 100 ^(100|[0-9]{1,2})$



1.2 getstudent.h

1 # ifndef GETSTUDENT_H
2 # define GETSTUDENT_H
3


4 # include < QMainWindow >
5 # include < QRegularExpressionValidator >
6

7 Q T_ BE GI N_NA ME SP AC E
8 namespace Ui { class GetStudent ; }
9 QT_END_NAMESPACE
10

11 class GetStudent : public QMainWindow {
12 Q_OBJECT
13 public :
14 explicit GetStudent ( QWidget * parent = nullptr ) ;
15 ~ GetStudent () ;
16


17 private slots :



Page 2 of 23

, UNISA | COS3711 Advanced Programming – Assignment 3



18 void o n _ a d d B u t t o n _ c l i c k e d () ;
19


20 private :
21 Ui :: GetStudent * ui ;
22 bool validateInputs ( QString & errorMsg ) ;
23 };
24

25 # endif // GETSTUDENT_H




1.3 getstudent.cpp

1 # include " getstudent . h "
2 # include " ui_getstudent . h "
3 # include < QRegularExpression >
4 # include < QRegularExpressionValidator >
5 # include < QMessageBox >
6 # include < QTextStream >
7 # include < iostream >
8

9 GetStudent :: GetStudent ( QWidget * parent )
10 : QMainWindow ( parent ) , ui ( new Ui :: GetStudent )
11 {
12 ui - > setupUi ( this ) ;
13


14 // -- Input masks give the user a visual format guide --
15 // Student number : 4 digits
16 ui - > studentNumberEdit - > setInputMask ( " 9999 " ) ;
17


18 // Module code : 3 uppercase letters + [123] + 2 digits + 1 alphanum
19 // No built - in mask for mixed alpha / digit at position 4 , so we use
20 // a validator instead and guide with placeholder text .
21 ui - > moduleCodeEdit - > set Pl ac eh ol de rT ex t ( " e . g . COS3711A " ) ;
22 ui - > moduleCodeEdit - > setMaxLength (7) ;
23


24 // Mark : up to 3 digits
25 ui - > markEdit - > setInputMask ( " 900 " ) ; // allows 0 -999; regex tightens
to 0 -100
26




Page 3 of 23

Connected book
 image
Publisher: 1970 ISBN: 9780983384021 Edition: Unknown

Document information

Uploaded on
March 24, 2026
Number of pages
23
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$4.91

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
BeeNotes
4.1
(40)
Sold
331
Followers
0
Items
974
Last sold
14 hours ago




Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

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

Student with book image

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

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions