Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 ( 2 0 marks ) This question focuses on Part 1 ( variables ) , Part 2 ( constants , lists, arithmetic and
Question marks This question focuses on Part variables Part constants lists, arithmetic and joining strings and Part selection Open the project TMQsb 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 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 If the number, as a percentage of the maximum of is more than then the pupil will be awarded a Yellow Jersey sticker. In this project, we have provided a whengreenflagclicked script and a whenspacekeypressed script. Consider these scripts carefully and then answer the questions below. aImagine a scenario in which the user starts the program, then presses the space key, and enters Ella and then when prompted. Copy and complete the following stepbystep 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 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 not what the script does in general or what might have happened with different inputs. marks b iIdentify 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. mark iiWhat might be an appropriate name for the constant you have chosen? mark cAmend the whengreenflagclicked and whenspacekeypressed scripts so that: If a pupil completes more kilometres than of the maximum, their name is added to the list Yellowlist. Otherwise, their name is added to a list Greenlist which you should create and initialise appropriately Take a screenshot of your resulting scripts and paste it into your TMA document. marks d iFurther amend the whengreenflagclicked and whenspacekeypressed scripts so that: If a pupil completes more kilometres than of the maximum, their name is added to the list Yellowlist. If a pupil completes fewer kilometres than of the maximum, their name is added to a list Polkadotlist which you should create and initialise appropriately Otherwise, their name is added to the list Greenlist. 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 Name List name is added to Just below lower boundary value p Polkadotlist Lower boundary value equivalent to p Greenlist Just above lower boundary value p Greenlist Just below upper boundary value p Greenlist Upper boundary value equivalent to p Greenlist Just above upper boundary value p Yellowlist Take a screenshot of your resulting scripts and paste it into your TMA document. marks iiDifferent forms of selection structure could be used to meet the specification in Question di Briefly describe an alternative form of selection structure to the one you chose. marks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started