Uppercase Letter Q Template 4 Thoughts You Have As Uppercase Letter Q Template Approaches
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.
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
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
IF badAlpha = FALSE THEN
SEND ‘Final three characters are valid’ TO DISPLAY
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.
Uppercase Letter Q Template 4 Thoughts You Have As Uppercase Letter Q Template Approaches – uppercase letter q template
| Pleasant in order to my own blog site, within this time period I will teach you concerning keyword. Now, this can be the first image: