Question 3
Edexcel Computer Science June 2022 Paper 2GCSE10 marks
On the specification
- 6.2 Program constructs6.4 Input and output6.5 Operators
Question text
3 A circle is cut out of a square of card. A program is needed to calculate the area of the excess card. The image shows the excess card in light grey. The required formulae are: 2 area of a square = s diameter of a circle = 2r 2 area of a circle = πr • s is the length of a single side of the square • r is the radius of the circle, the distance from the centre to the edge • π is the constant Pi. The table shows accurate test results for two sets of inputs. Input Output Length of side Radius of circle 12 8 Invalid input 10 4 49.73451754256331 The program has these requirements: • the length of the square’s side is an integer • the radius of the circle is an integer • the user inputs both the length of a side and the radius (no validation required) • the diameter of the circle must be the same size or smaller than the side of the square • the variables supplied in the code file must be used. Open file Q03.py Amend the code to meet the requirements. Do not change the functionality of the given lines of code. Do not add any additional functionality. Save your amended code file as Q03FINISHED.py (Total for Question 3 = 10 marks)