Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 ( 2 0 marks ) This question focuses on Part 1 ( variables ) , Part 2 ( constants , lists, arithmetic and

Question 1(20 marks) This question focuses on Part 1(variables), Part 2(constants, lists, arithmetic and joining strings) and Part 3(selection). Open the project TM111_02_Q1.sb2. This project is intended to implement a program to help the teacher record how many kilometres pupils have completed during a charity bicycle ride, up to a maximum of 40 km. Before recording the number of kilometres completed by each pupil, the teacher will start the program using the green flag. She will then press her space key whenever she wants to record a pupils completed number of kilometres, which she will enter out of a maximum of 40. If the number, as a percentage of the maximum of 40, is more than 75%, then the pupil will be awarded a Yellow Jersey sticker. 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.Imagine a scenario in which the user starts the program, then presses the space key, and enters Ella, and then 32 when prompted. Copy and complete the following step-by-step description of what happens, starting from the point at which the user is prompted for input. The user is asked to enter a pupils name. Their input, Ella, is stored in the variable name. The user is asked to enter the number of kilometres completed by the pupil out of a maximum of 40... 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. You should describe what happens in the particular scenario here, with the inputs Ella and 32, not what the script does in general or what might have happened with different inputs. (4 marks) b. i.Identify a numerical value used in this program that might appropriately be stored in a constant. (Recall that a constant is a value that plays a significant role in a program and does not change during the time the program is running.) 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 completes more kilometres than 75% of the maximum, their name is added to the list Yellow_list. Otherwise, their name is added to a list Green_list (which you should create and initialise appropriately). Take a screenshot of your resulting scripts and paste it into your TMA document. (5 marks) d. i.Further amend the when_green_flag_clicked and when[space]key_pressed scripts so that: If a pupil completes more kilometres than 75% of the maximum, their name is added to the list Yellow_list. If a pupil completes fewer kilometres than 35% of the maximum, their name is added to a list Polkadot_list (which you should create and initialise appropriately). Otherwise, their name is added to the list Green_list. Check that your program passes the following tests. (You arent expected to give any details of your testing; this is just to help you check your program.) Test number Test purpose Test inputs Expected results Kilometres completed, out of a maximum number of 40 Name List name is added to 1 Just below lower boundary value 13 p1 Polkadot_list 2 Lower boundary value 14(equivalent to 35%) p2 Green_list 3 Just above lower boundary value 15 p3 Green_list 4 Just below upper boundary value 29 p4 Green_list 5 Upper boundary value 30(equivalent to 75%) p5 Green_list 6 Just above upper boundary value 31 p6 Yellow_list Take a screenshot of your resulting scripts and paste it into your TMA document. (7 marks) ii.Different forms of selection structure could be used to meet the specification in Question 1(d)(i). Briefly describe an alternative form of selection structure to the one you chose. (2 marks)

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

Students also viewed these Databases questions

Question

What is a budget? What purposes does it serve?

Answered: 1 week ago

Question

Solve the following 1,4 3 2TT 5x- 1+ (15 x) dx 5X

Answered: 1 week ago