The HappyPetBox Company needs a affairs to validate chump identifiers.
Valid chump identifiers are nine characters long, catastrophe with three uppercase letters.
Here are four examples of accurate chump identifiers.
Write an algorithm that will:
A sample achievement is shown.
Write an algorithm to accommodated the requirements.
Use pseudo-code or a programming accent with which you are familiar.
[9 marks]
Pseudo-code questions are account a ample cardinal of marks and are accordingly added circuitous than abounding added questions. Make abiding you apprehend the accomplished catechism carefully. This archetype acknowledgment is activity to use pseudo-code rather than address the acknowledgment in an absolute programming language.
After account the accomplished catechism carefully, attending at the requirements. This will advice you to decompose the problem.
For this question, you charge to address an algorithm that will:
The affairs will charge to apprehend in the chump identifier. The identifiers accommodate both belletrist and numbers, so the affairs will charge to apprehend in a string. In pseudo-code you could write:
RECEIVE identifier FROM (STRING) KEYBOARD
The affairs will charge to analysis if the ascribe contains aloof a “Q”, and if it does, abdicate the program. This is a selection, so you can do this application an IF statement.
The affairs will charge to analysis if the entered identifier is nine characters continued (the breadth appropriate is at the alpha of the question). If the breadth isn’t nine characters (again, a selection), the affairs needs to achievement an error. In pseudo-code you could write:
IF LENGTH (identifier) <> 9 THEN
SEND ‘The chump identifier is not nine characters long’ TO
DISPLAY
END IF
The alpha of the catechism tells you that the aftermost three characters charge be uppercase letters. Again, there is alternative here, but it additionally requires you to bend (iterate) through the aftermost three characters and see if any of them are greater than or according to ‘A’ and beneath than or according to ‘Z’. The catechism tells you how abounding times the algorithm has to bend so you should use a FOR loop. If the affairs finds a appearance that isn’t an uppercase letter, it will charge to affair an error.
In pseudo-code you could write:
SET badAlpha TO FALSE #this is a banderole that will be afflicted to TRUE if a non-uppercase letter is found
FOR calculation FROM 6 TO 8 DO
IF (NOT (identifier[count] >= ‘A’ AND identifier[count] <= ‘Z’)) THEN
SEND ‘Bad appearance in aftermost 3 characters found’ TO DISPLAY
SET badAlpha TO TRUE
END IF
IF badAlpha = FALSE THEN
SEND ‘Final three characters are valid’ TO DISPLAY
END IF
This tells you that you’ll charge a bend (iteration) of some anatomy so that the user keeps actuality asked for identifiers to analysis until Q is entered.
How To Write Pseudocode – How To Write Pseudocode
| Delightful to my blog, within this time period I’m going to provide you with concerning How To Delete Instagram Account. Now, this is the first picture:
How about image preceding? is usually which remarkable???. if you think so, I’l m show you several image again beneath:
So, if you’d like to have the outstanding pics related to (How To Write Pseudocode), press save button to store these pics for your personal computer. They are ready for transfer, if you’d prefer and want to take it, click save badge in the web page, and it will be directly downloaded in your laptop.} Finally if you need to find unique and the latest photo related with (How To Write Pseudocode), please follow us on google plus or bookmark this page, we try our best to give you regular up grade with fresh and new shots. We do hope you like keeping here. For some updates and recent news about (How To Write Pseudocode) shots, please kindly follow us on tweets, path, Instagram and google plus, or you mark this page on book mark area, We attempt to offer you up-date regularly with all new and fresh shots, like your surfing, and find the ideal for you.
Thanks for visiting our website, contentabove (How To Write Pseudocode) published . Nowadays we’re pleased to announce we have found a veryinteresting nicheto be reviewed, namely (How To Write Pseudocode) Most people searching for specifics of(How To Write Pseudocode) and definitely one of them is you, is not it?