Question 15

AQA Computer Science June 2025 Paper 1 (7516/1)AS5 marks

On the specification

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

15 This question extends the functionality of the Skeleton Program. The Skeleton Program is to be changed so that the time the pirate spends walking is recorded and displayed at the end of the game. The subroutine PirateWalks needs to be modified so that a total of the time the pirate walks is kept: • walking one length N, E, S or W counts as 1.0 hours walking • walking one length in a diagonal direction (NE, SE, SW, NW) counts as 1.4 hours walking. At the end of the game, the total hours walked is to be output as part of the results. What you need to do: Task 1 In PirateRecord create an extra field WalkTime to store the number of hours walked as a number with a fractional part value. Initialise the value of WalkTime to 0.0 in the ResetPirateRecord subroutine. Task 2 Amend the subroutine PirateWalks to calculate the time walked and update the WalkTime field in the Pirate variable. Task 3 Amend the subroutine DisplayResults to output the total time spent walking with an appropriate message. Task 4 Test that the changes you have made work by conducting the following test: • run your amended Skeleton Program • enter W • enter 8NE • enter W • enter 9E • press ENTER Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 15.1 Your PROGRAM SOURCE CODE: • for the entire subroutine ResetPirateRecord • for the entire subroutine PirateWalks • for the entire subroutine DisplayResults. [4 marks] 15.2 SCREEN CAPTURE(S) showing the requested test described in Task 4. The SCREEN CAPTURE(S) must show the map with the pirate’s final position as well as the results. [1 mark]