Question 5

Edexcel Computer Science June 2024 Paper 2GCSE15 marks

On the specification

6.2 Program constructs6.3 Data types and structures6.6 Subprograms
Question text

5 A program is being developed to work with pasta shapes. The pasta shape names are stored in a one-dimensional array. The user is shown a menu of options. When the user chooses an option, the program performs the task. The program loops until the user chooses the exit menu option. Open file Q05.py Amend the code to: • complete the getChoice() subprogram – allow the user to enter a menu option number (no validation required) – return the choice to the main program • complete the getShape() subprogram – use a random number as an index into the pastaShapes array – return the shape to the main program • complete the addShape() subprogram – allow the user to enter a new pasta shape name – add the new name to the end of the pastaShapes array • complete the main program – call each subprogram based on the menu option entered by the user – display the shape from the getShape() subprogram – tell the user when an inputted option number is not on the menu. Use the constants and variables provided. Do not add any additional functionality. Save your amended code as Q05FINISHED.py (Total for Question 5 = 15 marks)