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

COS3711 Assignment 3 (QUALITY ANSWERS) 2024

Rating
-
Sold
-
Pages
21
Grade
A+
Uploaded on
25-06-2024
Written in
2023/2024

This document contains workings, explanations and solutions to the COS3711 Assignment 3 (QUALITY ANSWERS) 2024. For assistance call or us on 0.6.8..8.1.2..0.9.3.4...... Question 1 Write an application that can be used to process Staff member details. The fields that should be stored include: • A name, • A birthdate, and • A staff appointment type (one of permanent, part-time, or contract, stored as an enum). Note that the getter and setter for this data member may be done using a QString. Downloaded by Corona Virus () lOMoARcPSD| The application should allow a user to enter details via GUI. Also, once a staff member’s details are entered, they should be written to file (in any acceptable format) and stored in a container in the application. Ensure that you adhere to basic design principles, and avoid any anti-patterns in the design of your solution. Question 2 Taking Question 1 a step further, make all the getters and setters (including any toString() functions) that give access to the data members name, birthdate and staff type private. Then make the necessary changes so that your application uses reflective programming techniques to access the data members in the object that holds the staff data when writing to file. Note that you cannot assume that you know beforehand how many properties there are, what they are called, or of what type they are. You will need to be more specific when handling the enum, though (and in this case you can accept that you know what its values are); also, you will have to move away from using a QString for the enum here. HINT: You will need to use QVariant. Question 3 Write an application that uses regular expressions to check for problems in a text file provided by a user. The following functionality should be included. • The user should be able to select the file to check using a standard file open dialog box. • There should be some way of indicating that the file has been loaded. • Problematic words should be displayed, giving the line number and the word number in the line as well. The following problematic words should be flagged (using regular expressions to identify such words): • Words with a number anywhere in the word • Words with a capital letter in any position apart from at the start of the word. Downloaded by Corona Virus () lOMoARcPSD| • Words that have any special characters (like #, *, /, @, ^, and so on) as part of the word. Note that a – is acceptable. The screenshot below gives examples of words that should be flagged. Question 4 Write an application that can check passwords (using regular expressions) and indicate if they are acceptable or not acceptable according to the following rules. • It must be at least 5 characters in length. • It must contain at least one capital/uppercase letter. • It must contain at least one lowercase letter. • It must contain at least one number/digit. • It may not contain any repeating characters (that is, “ele” is acceptable, but “eel” is not). The application should indicate as you type whether the text provided is acceptable and should not rely on the user having to press a button to check acceptability.

Show more Read less










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

Document information

Uploaded on
June 25, 2024
Number of pages
21
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS3711
Assignment 3 2024
Unique Number:
Due Date: 9 September 2024



This document includes:

• Helpful answers and guidelines
• Detailed explanations and/ or calculations
• References




Connect with the tutor on

+27 68 812 0934

,© Study Shack 2024. All rights Reserved +27 68 812 0934

, QUESTION 1

Sure, let me provide a high-level design and implementation outline for the
application using C++ with the Qt framework. We'll create the necessary
classes to handle this functionality while ensuring proper separation of
concerns.



### High-Level Class Structure



1. Staff class: Represents an individual staff member.

2. StaffList class: Manages a list of Staff objects.

3. StaffWriter class: Handles writing Staff objects to a file.

4. MainWindow class: Provides GUI for user interaction.



### Staff.h
/// cpp
#ifndef STAFF_H
#define STAFF_H

#include <QString>
#include <QDate>

class Staff {
public:
enum class AppointmentType { Permanent, PartTime, Contract
};

Staff(const QString& name, const QDate& birthdate,
AppointmentType type);

// Getters
QString getName() const;
QDate getBirthdate() const;
QString getAppointmentType() const;

// Setters
void setName(const QString& name);
void setBirthdate(const QDate& birthdate);
void setAppointmentType(const QString& type);

private:



© Study Shack 2024. All rights Reserved +27 68 812 0934

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.
StudyShack Cornerstone College, Pretoria, Gauteng
View profile
Follow You need to be logged in order to follow users or courses
Sold
30694
Member since
9 year
Number of followers
13937
Documents
1800
Last sold
4 weeks ago
Study Guides for Unisa Students

4,1

1778 reviews

5
970
4
335
3
264
2
80
1
129

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