Section A You are advised to spend no longer than 40 minutes answering this section. Here is a copy of the pre-release material. DO NOT attempt Tasks 1, 2 and 3 now. Use the pre-release material and your experience from attempting the tasks before the examination to answer Question 1. Pre-release Material The manager of a parcel delivery service needs a program to check the size and weight of parcels to determine which parcels can be accepted for delivery. 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 size and weight of a single parcel Each parcel must obey the following rules to be accepted for delivery: • each dimension must be no more than 80 cm • the sum of the three dimensions must be no more than 200 cm • the weight of the parcel must be between one and ten kilograms inclusive Input and store the weight and dimensions for one parcel. All the dimensions and the weight must be validated on entry and an unsuitable parcel rejected. Output if the parcel is accepted or rejected. If rejected, output all the reasons why the parcel was rejected. TASK 2 – Check a customer’s consignment of parcels Input and store the number of parcels in the consignment. Calculate the number of parcels accepted and the total weight of the parcels accepted. For each parcel that was rejected, output all the reasons why that parcel was rejected. Output the number of parcels accepted and the total weight of parcels accepted. Output the number of parcels rejected. TASK 3 – Calculate the price for a customer’s consignment of parcels Extend TASK 2 to also calculate the price for each parcel, using the following rules: • 1 kg to 5 kg inclusive costs $10 • Each 100 grams over 5kg, up to 10kg, costs an extra $0.10 Your output should also include the price for each parcel accepted and the total price of the consignment.
- (a)(i)For each of the variables that you have used to record dimensions of the parcels in Task 1, state the name, type and its use. Variable 1 name Type.. Use Variable 2 name Type. Use Variable 3 name Type. Use[3]
- (a)(ii)State two constants that you could have used for Task 1. Give the value that would be assigned to each one. Constant 1 name Value 1 Constant 2 name Value 2[2]
- (b)Write an algorithm to complete Task 1, using either pseudocode, programming statements or a flowchart.[5]
- (c)Give three different data sets that could be used to check your validation rules for Task 1. Explain why you chose each data set. Data set 1 Reason for choice Data set 2 Reason for choice Data set 3 Reason for choice[6]
- (d)Explain how your program calculates the price for a consignment (part of Task 3). You may include programming statements as part of your explanation.[4]
Mark scheme
Marking points from the official mark scheme (May/June 2016). The mark or mark type is shown in brackets.
- [3] (a) (i) Many correct answers, names must be meaningful. This is an example only. Length, real/integer, length of parcel Breadth, real/integer, breadth of parcel Height, real/integer, Height of parcel
- [2] (a) (ii) Several correct answers, they must be meaningful. These are examples only. Dimension, 80 TotalDimension 200 MaxWeight 10.00
- [5] (b) Any 5 from: – input length, breadth, height and weight – check each dimension, not more than 80 – check total of dimensions, not more than 200 – check weight at least 1 – check weight not more than 10 – output parcel accepted (must be in appropriate position) – output parcel rejected (must be in appropriate position) – output all reasons for rejecting parcel (reason must follow test) Max 5 marks Sample Answer. INPUT Length, Breadth, Height, Weight IF Length <= 80 AND Breadth <= 80 AND Height <= 80 AND Weight >= 1 AND Weight <=10 AND Length + Breadth + Height <= 200 THEN PRINT 'Parcel accepted' ELSE PRINT 'Parcel rejected' IF Length > 80 OR Breadth > 80 OR Height > 80 THEN PRINT 'At least one dimension too large' ENDIF IF Weight < 1 THEN PRINT 'Parcel too light' ENDIF IF Weight > 10 THEN PRINT 'Parcel too heavy' ENDIF ENDIF
- [6] (c) 1 mark for the data set and 1 mark for the matching reason all, data sets and reasons must be different. There are many possible correct answers these are examples only. Data set 30, 29, 28, 4 Reason – normal data; parcel should be accepted Data set 80, 60, 60, 10 Reason - boundary data; parcel should be accepted Data set-85, 60, 60, 11 Reason - abnormal data; parcel should be rejected
- [4] (d) Maximum 4 marks in total, maximum 2 marks if only programming statements used. Explanation (may include reference to programming statements) loop for number of parcels parcels 5 kg or less use standard price over 5 kg use weight to calculate price Correct calculation of price keep running total of consignment price
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →