Writing your answer
Once you’ve thought about how you’ll meet each individual requirement, you need to write the answer in pseudocode Also written as pseudo-code. A method of writing up a set of instructions for a computer program using plain English. This is a good way of planning a program before coding.. Remember, you can add comments to pseudo-code by putting a # at the start of the comment. Comments in pseudo-code questions enable you to explain things that aren’t obvious to the examiner.
SET looping TO TRUE #used to keep the loop running until the user wants to quit
WHILE looping = TRUE DO #loop to keep asking for identifiers
#get identifier from user
RECEIVE identifier FROM (STRING) KEYBOARD
IF identifier = ‘Q’ THEN #user wants to quit
SET looping TO FALSE #loop won’t run again as condition will be false
SEND ‘Bye’ TO DISPLAY
ELSE IF LENGTH (identifier) <> 9 THEN
SEND ‘The customer identifier is not nine characters long’ TO DISPLAY
ELSE
#check last 3 characters
SET badAlpha TO FALSE #this is a flag that will be changed to TRUE if a non-uppercase letter is found
FOR count FROM 6 TO 8 DO
IF (NOT (identifier[count] >= ‘A’ AND identifier[count] <= ‘Z’)) THEN
SEND ‘Bad character in last 3 characters found’ TO DISPLAY
SET badAlpha TO TRUE
END IF
END FOR
IF badAlpha = FALSE THEN
SEND ‘Final three characters are valid’ TO DISPLAY
END IF
END IF
It is important to use easy-to-understand identifierA name given to a part of a program, such as a variable, constant, function, procedure or module. names and use indentation correctly as this will make the pseudo-code easier to read and help you gain maximum marks.