Question 4
OCR Computer Science November 2020 Paper 2AS9 marks
On the specification
- 2.2 Problem solving and programming
Question text
4 Daisy is a computer technician. She is responsible for making sure all new employees are given a username to access the computer network. The rules that are followed when creating a new username are as follows: Step 1: The employee’s first name is entered (e.g. Roger) Step 2: The employee’s surname is entered (e.g. Banks) Step 3: A username is then made up from: ○ Their whole surname (e.g. Banks) ○ The first letter of their first name (e.g. R) ○ A number 1 For example: BanksR1 Step 4: The username is then checked against existing usernames. This is done by calling a function existingUsers. This will return true if the username is unique and false if the username already exists. Step 5: If the username is unique then “Username is Unique” should be printed. If the username already exists then the number at the end of the username should increase by one (e.g. BanksR2). Step 6: Steps 4 and 5 should be repeated until the username is unique. Write a procedure called createUsername that meets the rules of Daisy’s program. You should write your procedure using pseudocode or program code. [9]