Question 8

OCR Computer Science November 2020 Paper 1AS5 marks

On the specification

2.2 Problem solving and programming
Question text

8 Albert runs a competition each week in his local village hall. So that Albert can contact the winner he would like a program for the winner to enter their telephone number which is then checked and written into a text file. The rules for Albert’s program are as follows: 1. The telephone number is entered. This is checked to ensure that the first digit is a 0 2. If the first digit is not a 0 then a message saying “Needs To Start With 0” is printed 3. If the first digit is a 0 then the telephone number is passed into a pre-existing function called checkLength as a parameter. This will return true if the length of the telephone number is long enough 4. If the telephone number is long enough then it is written into a text file called "winner.txt" 5. If the telephone number is not long enough then a message saying “Not Long Enough” is printed. Complete the procedure competitionWinner so that it meets the rules of Albert’s program. You should write your procedure using pseudocode or program code. procedure competitionWinner() endprocedure [5]