Search for question
Question

Question 3 (25 marks) This question focuses on Part 3 (selection) and Part 4 (repetition). As inspiration for this question, you might like to revisit Activity 4.8 of Part 4, which

uses a list of specific characters. The teacher wishes to see if her pupils can make sense of words in which certain letters have been removed. She requires a when[space]key_pressed script that will take a word from the user and display a new word that is the same as the original except that each vowel has been removed. For clarification, the vowels should be considered as: a, e, i, o and u. The user should input the word as a single string and the new word that is displayed should be a single string For example, if the user enters 'ratse then 'rs' is displayed. One way to create the new word to be displayed is to start with the new word as an empty string and then work through the letters in the original word from first to last, creating the new word incrementally. If the current letter is not a vowel then we add it to the new word, otherwise we ignore it. This might be visualised as in Figure 2. Original word New word so far: Test number 1 2 New word so far: Y 3 a a. Create and write down an algorithm to solve this problem. You might like to use the idea above, or an alternative of your own. New word so far: Y (10 marks) b. Create a when[space]key_pressed script to implement your algorithm. Depending on your algorithm and the way in which you choose to implement it, you may also decide to have a when_green_flag_clicked script. Take a screenshot of your script(s) and paste it into your TMA document (11 marks) c. Copy the following table into your TMA document and add to it two tests you would perform to check whether the completed program fulfils the specification. (Several tests might be appropriate; however, you are only required to add two.) Test purpose New word so far: First and last letters are vowels New word so far: 'rs Inputs Word apple Expected results New word displayed ppl New word so far: 'Y/nThe teacher wishes to see if her pupils can make sense of words in which certain letters have been removed. She requires a when[space]key_pressed script that will take a word from the user and display a new word that is the same as the original except that each vowel has been removed. For clarification, the vowels should be considered as: a, e, i, o and u. The user should input the word as a single string and the new word that is displayed should be a single string. For example, if the user enters 'raise' then 'rs' is displayed. One way to create the new word to be displayed is to start with the new word as an empty string and then work through the letters in the original word from first to last, creating the new word incrementally. If the current letter is not a vowel then we add it to the new word, otherwise we ignore it. This might be visualised as in Figure 2. Original word New word so far: "* r New word so far: 'r' New word so far: 'r' i New word so far: 'r' S New word so far: 'rs' CD New word so far: 'rs'

Fig: 1

Fig: 2