Question 12

AQA Computer Science June 2022 Paper 1 (7517/1)A level9 marks

On the specification

12.1
3.1 Fundamentals of programming3.2 Fundamentals of data structures
12.2
3.3 Systematic approach to problem solving
Question text

12 This question extends the Skeleton Program so that it displays some information about the contents of the deck to the player. The program needs to be modified so that it displays messages telling the player how many cards are in the deck and how many tool cards there are in the deck. A tool card is a pick, file, or key. What you need to do Task 1 Modify the PlayGame subroutine in the Breakthrough class so that a message is displayed telling the player how many cards there are in the deck. This message should be displayed after the message telling the player what their current score is and before the contents of the player’s hand are displayed. Task 2 Create a subroutine GetNumberOfToolCards in the CardCollection class that calculates how many tool cards there are in the Cards data structure. It should return the calculated value to the calling routine. Task 3 Modify the PlayGame subroutine in the Breakthrough class so that a message is displayed telling the player how many tool cards there are in Deck. This message should use the value returned by calling the GetNumberOfToolCards subroutine for Deck. This message should be displayed after the message telling the player what their current score is and before the contents of the player’s hand are displayed. Task 4 Test that the changes you have made work: • run the Skeleton Program • play a new game • enter U • enter 2 • enter D Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 12.1 Your PROGRAM SOURCE CODE for the new subroutine GetNumberOfToolCards and the amended PlayGame subroutine. [8 marks] 12.2 SCREEN CAPTURE(S) showing the requested test. [1 mark]