Question 16
AQA Computer Science June 2024 Paper 1 (7516/1)AS8 marks
On the specification
- 16.1
- 3.1 Fundamentals of programming3.3 Systematic approach to problem solving
- 16.2
- 3.3 Systematic approach to problem solving
Question text
16 This question extends the functionality of the Skeleton Program. When a buyer enters the shop and sees a long queue, they will change their mind and leave the shop without buying anything. This is known as a shun. The Skeleton Program is to be changed so that a buyer shunning the queue will cause the shop to open another till, subject to the maximum number of tills available not being exceeded. The subroutine BuyerArrives needs to be modified so that a buyer arriving when the queue length is 5 will not join the queue. A running total of the number of buyers shunning the queue is to be kept. After a buyer has shunned the queue, the shop will open another till, until the maximum number of tills available have opened. At the end of the simulation the number of buyers that have shunned the queue should be output as part of the statistics. What you need to do: Task 1 Create a constant value to use as an index for a previously unused element of the data structure Stats in which to store the count of the number of shuns. Task 2 Amend the subroutine BuyerArrives so that a buyer only joins the queue when fewer than 5 buyers are in the queue and shuns the queue if there are 5 buyers in the queue. If a buyer shuns the queue, the number of shuns and the number of tills operating should be updated as appropriate and a suitable message showing the ID of the buyer that has shunned the queue should be displayed. Task 3 Amend the subroutine OutputStats to output the total number of shuns 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 Y • enter 50 • enter 1 Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 16.1 Your PROGRAM SOURCE CODE: • that sets the value of the new constant • for the entire subroutine BuyerArrives • for the entire subroutine OutputStats. [7 marks] 16.2 SCREEN CAPTURE(S) showing the requested test described in Task 4. The SCREEN CAPTURE(S) only need to show the simulation statistics that are displayed when the simulation finishes. [1 mark]