Question 11
AQA Computer Science June 2017 Paper 1A level12 marks
On the specification
- 11.1
- 4.1 Fundamentals of programming
- 11.2
- 3.1 Fundamentals of programming4.2 Fundamentals of data structures
- 11.3
- 3.1 Fundamentals of programming4.2 Fundamentals of data structures
- 11.4
- 3.1 Fundamentals of programming4.2 Fundamentals of data structures
- 11.5
- 4.13 Systematic approach to problem solving
Question text
11 The simulation is to be extended to represent the landscape that the animals live in. Most of the landscape will be land, but two rivers will run through it. The locations of the rivers are shaded in Figure 13. Figure 13 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Each of the individual locations, eg (12, 7), within the landscape will be assigned to be an area of either land or river. What you need to do Task 1 Modify the Location class so that it can store a representation of the type of terrain at the location. This representation should be as a character, with "L" representing land and "R" representing river. Task 2 Modify the constructor subroutine of the Location class so that when a location is created, the constructor is passed the type of terrain that the location will be and this is stored appropriately. Task 3 Modify the CreateLandscapeAndAnimals subroutine in the Simulation class so that when the landscape is created the appropriate type of terrain, as shown in Figure 13, is stored in each location. The terrain should be represented as a character, with "L" representing land and "R" representing river. Task 4 Modify the DrawLandscape subroutine in the Simulation class so that the correct type of terrain at each location is displayed when the landscape is drawn. Figure 14 shows one example of how the landscape could be drawn, with a letter "L" indicating that a location contains land, and a letter "R" indicating that a location contains part of a river. However, you are free to indicate the type of terrain at a location in any way that you choose, so long as this is clear to the user. Figure 14 Task 5 Modify the CreateNewWarren and CreateNewFox subroutines in the Simulation class so that warrens and foxes cannot be created in locations that are part of a river. Test Check that the changes you have made in Tasks 1 to 4 (not Task 5) work by conducting the following test: • Select option "1. Run simulation with default settings" from the main menu. Evidence that you need to provide Include the following in your Electronic Answer Document. 11.1 Your PROGRAM SOURCE CODE for the whole of the Location class, including the constructor subroutine. [3 marks] 11.2 Your PROGRAM SOURCE CODE for the amended CreateLandscapeAndAnimals subroutine from the Simulation class. [3 marks] 11.3 Your PROGRAM SOURCE CODE for the amended DrawLandscape subroutine from the Simulation class. [2 marks] 11.4 Your PROGRAM SOURCE CODE for the amended CreateNewWarren and CreateNewFox subroutines from the Simulation class. [3 marks] 11.5 SCREEN CAPTURE(S) for the described test, showing the correct type of territory in each location on the landscape. [1 mark]