Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question focuses on Part 3 ( selection ) and Part 4 ( repetition ) . As inspiration for this question, you might like to

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 duplicated.
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 consonant has been duplicated. For clarification, the consonants should be considered as: b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y and z.
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
metal
then
mmettall
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 consonant then we add it to the new word, otherwise we add two of it to the new word.
Recall that, 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.
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)
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 number Test purpose Inputs Expected results
Word New word displayed
1 First and last letters are consonants leaf lleaff
2
3

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

Approximately 3.3% of youths have ODD and 3.2% have CD.

Answered: 1 week ago