Question 13
AQA Computer Science June 2023 Paper 1 (7516/1)AS6 marks
On the specification
- 13.1
- 3.1 Fundamentals of programming
- 13.2
- 3.3 Systematic approach to problem solving
Question text
13 This question adds validation to the Skeleton Program. The subroutine EditSourceCode asks the user to enter a line number. The line number must be an integer and the number of an existing line in the file containing the program. For example, the last line (line 11) of prog2.txt is: FINAL: 0 Therefore, a valid line number for prog2.txt would be an integer between 1 and 11 inclusive. What you need to do: Task 1 Amend the subroutine EditSourceCode to check that the line number entered by the user is a valid existing line number. If an invalid value is entered the subroutine should output an appropriate error message. The program must not continue until a valid line number has been entered. Task 2 Test that the changes you have made work by conducting the following test: • run your amended Skeleton Program • enter L • load prog2 • enter E • enter Q • enter 22 • enter 0 • enter 2 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 13.1 Your PROGRAM SOURCE CODE for the entire subroutine EditSourceCode. [5 marks] 13.2 SCREEN CAPTURE(S) showing the requested test described in Task 2. [1 mark]