COMPUTER SCIENCE 0478/22 COMPUTER SCIENCE 2210/22
Paper 2 Problem-solving and Programming
PRE-RELEASE MATERIAL MAY/JUNE 2016
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, constans and other identifiers must have meaningful names.
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
- Sand and gravel must weigh over 49.0 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 o each type required for the order. Use TASK 1 to check the contents and weigh 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
- 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.