Friday, June 22, 2012

Sample test in string handling


Each dog that arrives at the SPCA gets a tag with a code on it.  Use the breed and a random number to determine the code for each dog

1.     Create a new project in Scratch. 

1.1.   When you click on the green flag, the program must :

1.1.1.       Ask the user for the breed of the dog e.g. German Shepard and store the answer in a variable named breed                                                                             (2)

1.1.2.       Use string handling to remove the vowels from the breed                                                                             (6)

1.1.3.       Now use the first 4 characters of the breed and combine it with a random number between 100 and 999                                                                             (6)

1.1.4.       Display the a message with the code for the dog                                                                             (1)

e.g.

german shepherd – code will be grmn and a 3 digit random number for example grmn374

Solution

No comments:

Post a Comment