Computer Science (0478) · May/June 2016 · PRE 22
Cambridge Computer Science (0478) pre for paper 22, May/June 2016 — 0478/22/M/J/16, file 0478_s16_pre_22.pdf.
Text of this paper
www.dynamicpapers.com
Cambridge International Examinations
Cambridge International General Certificate of Secondary Education
0478/22
COMPUTER SCIENCE
Paper 2 Problem-solving and Programming
May/June 2016
PRE-RELEASE MATERIAL
No Additional Materials are required.
* 7 5 2 8 5 0 0 7 1 8 *
This material should be given to the relevant teachers and candidates as soon as it has been received
at the Centre.
READ THESE INSTRUCTIONS FIRST
Candidates should use this material in preparation for the examination. Candidates should attempt the
practical programming tasks using their chosen high-level, procedural programming language.
The syllabus is approved for use in England, Wales and Northern Ireland as a Cambridge International Level 1/Level 2 Certificate.
This document consists of 2 printed pages.
DC (LK) 106761/3
© UCLES 2016
[Turn over
www.dynamicpapers.com
2
In preparation for the examination candidates should attempt the following practical tasks by writing
and testing a program(s).
The manager of a building materials delivery service needs a program to check the contents and weight
of sacks to ensure that correct orders are made up for delivery. A price for the order will be calculated.
Write and test a program for the manager.
•
Your program must include appropriate prompts for the entry of data.
•
Error messages and other output need to be set out clearly.
•
All variables, constants and other identifiers must have meaningful names.
You will need to complete these three tasks. Each task must be fully tested.
TASK 1 – Check the contents and weight of a single sack
Each sack must obey the following rules to be accepted:
•
•
•
contain cement, gravel or sand, with a letter on the side for easy identification
o C - cement
o G - gravel
o S - sand
sand or gravel must weigh over 49.9 and under 50.1 kilograms
cement must weigh over 24.9 and under 25.1 kilograms
Input and store the weight and contents for one sack. The contents must be checked and an incorrect
sack rejected. The weight must be validated on entry and an overweight or underweight sack rejected.
Output the contents and weight of an accepted sack. If a sack is rejected, output the reason(s).
TASK 2 – Check a customer’s order for delivery
Input and store the number of sacks of each type required for the order. Use TASK 1 to check the
contents and weight of each sack. Ensure that the delivery contains the correct number and type of
sacks for the order.
Output the total weight of the order.
Output the number of sacks rejected from the order.
TASK 3 – Calculate the price for a customer’s order
Extend TASK 2 to calculate a price for an order. Prices for the sacks are as follows:
•
•
regular price for each sack
o cement, $3
o gravel, $2
o sand, $2
discount price for a special pack containing 1 sack of cement, 2 sacks of sand and 2 sacks of
gravel, $10
Calculate and output the regular price for the order. Check how many special packs are in the order. If
a discount price applies then output the new price for the order and the amount saved.
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every reasonable
effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will
be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International
Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after
the live examination series.
Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local
Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.
© UCLES 2016
0478/22/M/J/16