Question 10

AQA Computer Science June 2017 Paper 1A level6 marks

On the specification

10.1
4.1 Fundamentals of programming
10.2
4.13 Systematic approach to problem solving
Question text

10 The simulation is to be made more realistic by increasing the probability that a rabbit will die as a result of other causes, such as disease or injury, as the rabbit ages. The default probability of death by another cause for a rabbit is 0.05. • The probability of a male rabbit dying by another cause should increase by a factor of 50% after every time period. • The probability of a female rabbit dying by another cause should remain constant until the rabbit reaches the age of 2. At the age of 2, and after every time period beyond this, the probability of a female rabbit dying by another cause should increase by 0.05. Table 6 below summarises the probability of death by other causes for a rabbit of each gender, up to the age of 5. The probabilities will continue to increase beyond this age. Table 6 Probability of death by other causes Age Male (2dp) Female 0.05 0.05 10.08 0.05 20.11 0.1 30.17 0.15 40.25 0.2 50.38 0.25 What you need to do Create a new subroutine, CalculateNewAge, in the Rabbit class, that overrides the CalculateNewAge subroutine in the Animal class. The new CalculateNewAge subroutine in the Rabbit class should recalculate the probability of death for a rabbit as the rabbit ages. The subroutine should also call the subroutine that it has overridden in the Animal class to ensure that the standard ageing process for a rabbit continues to be carried out as well. Test Check that the changes you have made work by conducting the following test: • Select option "1. Run simulation with default settings" from the main menu. • Then select option "2. Advance to next time period hiding detail" twice, to advance the simulation to time period 2. • Then select option "4. Inspect warren" and enter the x coordinate 1 and the y coordinate 1. • When asked "View individual rabbits (y/n)?" enter y. Evidence that you need to provide Include the following in your Electronic Answer Document. 10.1 Your PROGRAM SOURCE CODE for the new subroutine CalculateNewAge from the Rabbit class. [5 marks] 10.2 SCREEN CAPTURE(S) for the described test. Your SCREEN CAPTURE(S) must clearly show the probability of death by other causes of both a male and a female rabbit of age 2. SCREEN CAPTURE(S) do not need to show the options that you have selected or the probability of death by other causes for rabbits of other ages. [1 mark]