Question 10

AQA Computer Science November 2020 Paper 1 (7517/1)A level6 marks

On the specification

10.1
3.1 Fundamentals of programming
10.2
3.3 Systematic approach to problem solving
Question text

10 This question refers to the method AddCompany in the Simulation class. The program is to be changed so that it checks that the company name entered is valid. The company must have a name and it cannot be the same as the name of an existing company. The program should keep doing these checks until a valid name for the company has been entered. What you need to do Task 1 Modify the method AddCompany so that an appropriate error message is displayed if the user presses the Enter key without entering a company name when they are asked to enter the name of the company. Task 2 Modify the method AddCompany so that an appropriate error message is displayed if the user enters the name of a company that is already being used for a company in the simulation when they are asked to enter the name of the company. You may use the method GetIndexOfCompany to find out if a company name has already been used, though you do not have to use this method in your answer. Task 3 Test that the changes you have made work: • run the Skeleton Program • choose to use a normal size settlement • choose to use the default companies • choose the option to add a new company from the menu • press the Enter key without entering a name for the new company • type in the name AQA Burgers and press the Enter key • type in the name In Jest and press the Enter key. Note: you will get three marks for your program code if either Task 1 or Task 2 has been successfully completed and you will get five marks if both Task 1 and Task 2 have been successfully completed. Evidence that you need to provide Include the following evidence in your Electronic Answer Document. 10.1 Your PROGRAM SOURCE CODE for the amended method AddCompany. [5 marks] 10.2 SCREEN CAPTURE(S) showing the results of the requested test. [1 mark]