You are organising a small LAN event - NSC Information Technology - Question 5 - 2017 - Paper 2
Question 5
You are organising a small LAN event. The participants will have to complete a registration form. The information will be used to keep track of their results as well... show full transcript
Worked Solution & Example Answer:You are organising a small LAN event - NSC Information Technology - Question 5 - 2017 - Paper 2
Step 1
5.1 Write an algorithm to create the access code.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Retrieve the user's name and surname.
Initialize an empty string for the access code.
Loop through each character in the name and surname:
If the character is a vowel (a, e, i, o, u) or a space, skip it.
If it is a consonant, append it to the access code string.
Change the first character of the access code to uppercase.
Change the last character of the access code to uppercase.
Append a '#' at the end of the access code.
Return the access code.
Step 2
5.2.1 What does the ':' indicate?
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The ':' indicates that the attributes are private fields in the UML diagram.
Step 3
5.2.2 What is the difference between a mutator and accessor method? Give an example of each making use of objLAN.
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Accessor methods retrieve the values of an object's fields without modifying them (e.g., GetTeamName).
Mutator methods change the values of an object's fields (e.g., CalculateCost).
Step 4
5.2.3 What is the purpose of a constructor?
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
A constructor instantiates the object and initializes the fields of the object with default or provided values.
Step 5
5.2.4 What is the purpose of a toString method?
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The toString method compiles the object's attributes into a single string variable for easy representation.
Step 6
5.3 Draw a trace table.
97%
121 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!