Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The teacher wishes to see if her pupils can make sense of words in which certain letters have been replaced by stars (asterisks). She requires

The teacher wishes to see if her pupils can make sense of words in which certain letters have been replaced by stars (asterisks). 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 of the last nine letters of the alphabet (r to z inclusive) has been replaced by two asterisks (**). 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 rattle then **a****le is displayed. Initially, you might think of working through the original word letter by letter, modifying it as you go. However, this is not the simplest way to achieve what is wanted. A better approach is to start a new word, which is empty at first, then work through the original word examining its letters one by one and adding either the same letter or **, as appropriate, to the new word. This is illustrated in Figure 2. Described image Figure 2 A piece of paper, labelled Original word, is shown, containing the following characters printed in a row: r a t . Below the piece of paper is a row of clouds containing text. The first cloud is to the left of the piece of paper and contains the text New word so far: . Subsequent clouds are each aligned with a character on the piece of paper above. The cloud below r contains the text New word so far: **. The cloud below a contains the text New word so far: **a. The cloud below t contains the text New word so far: **a**. Figure 2 Recall that, as in Part 4 Activity 4.8, a simple way to check whether a given character is one of a set of specific characters is to check whether it is in a list that has been populated with those specific characters. 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago