Open University Programming Worksheet

The

teacher

wishes

to

see

if

her pupils can make sense of words from 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 all letters in the second half of the alphabet (n to z inclusive) have been removed.

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

‘rhinocerous’

then

‘hice’

is displayed.

One way to think about creating the new word for display 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. This might be visualised as in

Figure

2

.

Figure 2

  • a.Create and write down an algorithm to solve this problem. You might like to use the ideas above, or alternatives 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 scriptaa
  • add to it two tests you would perform to check whether the completed program fulfills the specification. (Several tests might be appropriate: you are only required to add two

calf

2
Test number Test purpose Inputs Expected results
Word New word displayed
1 No letters in second half of alphabet calf
3
Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order