Description
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.
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.
•
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.
Reviews
There are no reviews yet.