Question 5(c) 2018 · May-June · Paper 21 · 9 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (c)
Question 9
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 9
Show text version of question
Question 5
Part (c)
Question 5
A golf club holds information about its members. When a member completes a round of golf, their
score is stored along with their membership number and the date of the round.
Part (c)
The information is stored in a text file, ScoreDetails.txt. The format of each line of the
text file is as follows:
<MembershipNumber><Date><Score>
- MembershipNumber is a four-digit numeric string.
- Date is a six-digit numeric string in the format DDMMYY
- Score is a two-digit numeric string in the range "50" to "99".
for several members on a particular date.
The procedure, AddNewScores(), will perform the following actions:
1. Prompt for the date of the scores. 2. Input the date of the scores. 3. Prompt for the membership number. 4. Input the membership number. 5. If the membership number is an empty string then end the procedure. 6. Prompt for the score. 7. Input the score. 8. Validate the score. 9. If the validation fails then repeat from step 6. 10. Form a text string from the data and write this to the ScoreDetails.txt file. 11. Repeat from step 3.
Question 11
Write program code for the AddNewScores() procedure.
Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.
Programming language ....................................................................................................................
Program code
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
......................................................................................................................................................[9]
Question 12
Why this question appears here
82% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s18_qp_21.pdf
