Elliott plays football for OCR FC - OCR - GCSE Computer Science - Question 4 - 2019 - Paper 1
Question 4
Elliott plays football for OCR FC. He wants to create a program to store the results of each football match they play and the names of the goal scorers. Elliott want... show full transcript
Worked Solution & Example Answer:Elliott plays football for OCR FC - OCR - GCSE Computer Science - Question 4 - 2019 - Paper 1
Step 1
Define what is meant by abstraction.
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Abstraction is a concept in programming that focuses on hiding the complex implementation details of a system while exposing only the necessary and relevant parts to the user. It allows programmers to simplify their designs by creating a simplified model of the system, which leads to better code organization and easier maintenance.
Step 2
Give one example of how abstraction could be used when developing this program.
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
One example of abstraction in this program could be creating a class that represents a football match. This class could encapsulate attributes such as the teams involved, the score, and a list of goal scorers, while hiding the complexities of how the scores are calculated or how the information is stored.
Step 3
Complete the following pseudocode for an algorithm to count up how many matches with 0 goals are stored in the array and then print out this value.
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
01 nogoalscount = 0
02 for count = 0 to (goals.length-1)
03 if goals[count] = 0 then
04 nogoalscount = nogoalscount + 1
05 endif
06 next count
07 print(nogoalscount)