Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Document preview thumbnail
Vista previa 3 fuera de 27 páginas
Examen

COS3711 Assigment 3 2026 Year Module Due 2026

Document preview thumbnail
Vista previa 3 fuera de 27 páginas

This assignment has been carefully put together to give you more than just answers; it walks you through the reasoning behind each one, so you actually understand the material rather than just memorising it. Every solution has been verified for accuracy, with academic references that hold up to scrutiny. Whether you're working through it the night before a submission or using it to reinforce your understanding over time, it's built to be genuinely useful. The explanations are clear without being condescending, and the structure follows what examiners actually look for not just what sounds impressive. If you put in the effort to engage with it properly, distinction-level results are well within reach.

Vista previa del contenido

UNIVERSITY OF SOUTH AFRICA (UNISA)
College of Science, Engineering and Technology







ASSIGNMENT 3
Year Module — 2026







Module Code: COS3711

Module Name: Advanced Programming

Assignment No.: 3

Semester: Year Module 2026

, UNISA | COS3711 Assignment 3 — Advanced Programming



Question 1: GetStudent GUI with Input Masks and Regex Validation

This question asks for a standalone Qt GUI application (called GetStudent) that collects a
student number, module code, and mark from the user, then prints them to standard output.
The output is deliberately kept simple because Question 2 reads it via QProcess.


1.1 Input Validation Rules


The three fields have precise format requirements. A QRegularExpression validator is ap-
plied to each QLineEdit so the user cannot submit malformed data.

Table 1: Validation rules for GetStudent fields
Field Rule Regex
Student number Exactly 4 digits ^\d{4}$
Module code 3 uppercase letters, then 1/2/3, ^[A-Z]{3}[123]\d{2}[\w]$
then 2 digits, then any char
Mark Integer 0 to 100 ^(100|[1-9]?\d)$



1.2 Project Structure


The GetStudent project consists of: main.cpp, getstudentwindow.h, and getstudentwindow.cpp.
No .ui file is required; the layout is built in code.


getstudentwindow.h


Listing 1: getstudentwindow.h
1 # ifndef G ETSTUDENTWINDOW_H
2 # define G ETSTUDENTWINDOW_H
3

4 # include < QWidget >
5 # include < QLineEdit >
6 # include < QPushButton >
7 # include < QLabel >
8

9 class GetStudentWindow : public QWidget {
10 Q_OBJECT
11 public :
12 explicit GetStudentWindow ( QWidget * parent = nullptr ) ;
13




Page 2 of 27

, UNISA | COS3711 Assignment 3 — Advanced Programming


14 private slots :
15 void onAdd () ;
16

17 private :
18 QLineEdit * studentNumEdit ;
19 QLineEdit * moduleCodeEdit ;
20 QLineEdit * markEdit ;
21 QPushButton * addBtn ;
22 QLabel * statusLabel ;
23

24 bool validate () ;
25 };
26

27 # endif // GETSTUDENTWINDOW_H




getstudentwindow.cpp


Listing 2: getstudentwindow.cpp
1 # include " getstudentwindow . h "
2 # include < QVBoxLayout >
3 # include < QHBoxLayout >
4 # include < QFormLayout >
5 # include < QRegularExpression >
6 # include < QRegularExpressionValidator >
7 # include < QMessageBox >
8 # include < QTextStream >
9 # include < iostream >
10

11 GetStudentWindow :: GetStudentWindow ( QWidget * parent )
12 : QWidget ( parent )
13 {
14 setWindowTitle ( " GetStudent " ) ;
15

16 // -- Student number : exactly 4 digits
17 studentNumEdit = new QLineEdit ;
18 studentNumEdit - > setInputMask ( " 9999 " ) ; // forces 4 - digit entry
19 studentNumEdit - > setPlaceholderText ( " e . g . 1234 " ) ;
20

21 // -- Module code validator : [A - Z ]{3}[123]\ d {2}[\ w ]
22 moduleCodeEdit = new QLineEdit ;
23 Q Reg ularExpression modRx ( " ^[ A - Z ]{3}[123]\\ d {2}[ A - Za - z0 -9] $ " ) ;


Page 3 of 27

Libro relacionado
 image
Desconocido Advanced Programming
Editorial: 1970 ISBN: 9780983384021 Edición: Desconocido

Información del documento

Subido en
24 de marzo de 2026
Número de páginas
27
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$4.91

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

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.
LectureLab
3.6
(86)
Vendido
683
Seguidores
188
Artículos
1553
Última venta
1 semana hace




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