Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project is intended to implement a program to help the teacher record the number of lengths of the pool, up to a maximum of

This project is intended to implement a program to help the teacher record the number of lengths of the pool, up to a maximum of 40, pupils can swim at the end of a series of school swimming lessons.

Before recording the number of lengths each pupil can swim the teacher will start the program with the green flag. She will then press her space key whenever she wants to record the number of lengths, which she will enter as a whole number out of 40. If the percentage of lengths a pupil can swim is more than 75% of the maximum they will be awarded a dolphin badge.

In this project we have provided a when_green_flag_clicked script and a when[space]key_pressed script. Consider these scripts carefully and then answer the questions below.

  • a.Complete the following step-by-step description of what the when[space]key_pressedscript does when the user starts the program with the green flag, then presses their space key, and enters 'Sami', and then 34. Your description should make clear what data is stored in the variables and the list involved, and the result of any comparison that is made.

The user is asked to enter a pupil's name. Their input, 'Sami', is stored in the variable name.

The user is asked to enter the number of lengths the pupil can swim.

(4 marks)

  • b.
    • i.Identify a numerical value in this program that might appropriately be stored in a constant. (There may be more than one possibility but you are only required to identify one. You are not asked to implement this constant.)

(1 mark)

  • ii.What might be an appropriate name for the constant you have chosen?

(1 mark)

  • c.Amend the when_green_flag_clicked and when[space]key_pressed scripts so that:
    • if a pupil can swim more than 75% of the maximum number of lengths their name is added to the list dolphin_badge_list
    • otherwise their name is added to a list duckling_badge_list (which you should create and initialise appropriately).

Take a screenshot of your resulting scripts and paste it into your solution document.

(5 marks)

  • d.
    • i.Further amend the when_green_flag_clicked and when[space]key_pressedscripts so that:
    • if a pupil can swim more than 75% of the maximum number of lengths their name is added to the list dolphin_badge_list
    • if a pupil can swim less than 25% of the maximum number of lengths their name is added to a list flipper_badge_list (which you should create and initialise appropriately)
    • otherwise their name is added to the list duckling_badge_list.

Check that your program passes the following tests. (You aren't expected to give any details of your testing; this is just to help you check your program.)

Testnumber

Test purpose

Test inputs

Expected results

No. of lengths, out of 40 max.

Name

Name added to list:

1

Just below lower boundary value

9

p1

flipper_badge_list

2

Lower boundary value

10 (equivalent to 25%)

p2

duckling_badge_list

3

Just above lower boundary value

11

p3

duckling_badge_list

4

Just below upper boundary value

29

p4

duckling_badge_list

5

Upper boundary value

30 (equivalent to 75%)

p5

duckling_badge_list

6

Just above upper boundary value

31

p6

dolphin_badge_list

  • Take a screenshot of your resulting scripts and paste it into your solution document.

(7 marks)

  • ii.Different forms of selection structure could be used to meet the specification in Q1 d(i). Describe briefly an alternative form of selection structure to the one you chose.

(2 marks)

I have posted the above question I am working through as part of TM111 Open University. I have answered all of the above except for part (d ii). Could anyone please help me with this question?

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

ACC 120 Wake Tech Financial Accounting W Connect Plus Access

Authors: J. David Spiceland

1st Edition

1308168926, 978-1308168920

More Books

Students also viewed these Accounting questions

Question

Explain the importance of nonverbal messages.

Answered: 1 week ago

Question

Describe the advantages of effective listening.

Answered: 1 week ago

Question

Prepare an employment application.

Answered: 1 week ago