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 A teacher is planning a school trip to a theme park at the end of term. You have been asked to write a program to work out the cost per student, to record those who are going and whether they have paid. The maximum number of students who can go on the trip is 45. Write and test a program for the teacher. • 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 – Work out the cost. The cost of the trip for each student is a share of the cost of a coach plus the cost of entry to the theme park. The total cost of the coach will be $550. The entry cost to the park is $30 for each student. The theme park gives one free ticket for every ten that are bought, which must be taken into consideration. Set up a program that: • stores the cost of the coach • stores the cost of an entry ticket • inputs the estimated number of students taking part, this must be validated on entry and an unsuitable entry rejected • calculates and outputs the recommended cost per student to ensure the trip does not make a loss. TASK 2 – Record the students who are going and whether they have paid. Input and store the names of the students who have asked to go on the trip up to the maximum number allowed. Input and store whether each student has paid. Enable printouts to be produced to show students who have not paid and those who have paid. TASK 3 – Work out final costs. Not all students will end up going on the trip, for example they might not have paid. Modify the program so that it gives overall totals for the costs charged and the amount of money collected. Output whether the school trip has made a profit or loss, or has broken even, and the amount of the final balance.
- (a)(i)Name two constants you used for Task 1 and state the value of each one.[2]
- (a)(ii)Name two arrays you used for Task 2 and state the purpose of each one.[2]
- (b)Write an algorithm to complete Task 1, using either pseudocode, programming statements or a flowchart.[5]
- (c)(i)Name and describe one suitable validation check you used for Task 1, and one suitable validation check for Task 2. Each check MUST be different.[4]
- (c)(ii)For each validation check in part (c)(i), give an example of suitable test data and explain why you chose the test data.[4]
- (d)Explain how your program calculates whether or not you have made a profit (Task 3). Any programming statements used in your answer must be fully explained.[3]
Mark scheme
Marking points from the official mark scheme (May/June 2017). The mark or mark type is shown in brackets.
- [1] 1 mark for two meaningful names of constants
- [1] 1 mark for two relevant values related to Task 1
- Many correct answers, they must be meaningful. These are examples only.
- Coach_cost, 550
- Ticket_cost, 30
- Max_Students, 45
- Free_Ticket, 10 (allow 9)
- [1] 1 mark for Any meaningful name AND purpose related to Task 2
- Many correct answers, they must be meaningful. These are examples only.
- Students / ArrayStudents to store the students' names
- paid / arrayPaid to record whether a student has paid or not
- Max 2 marks
- [5] Any five from:
- - Initialise values for both coach and ticket
- - Prompt for number of students taking part and input of number
- - Attempt at validation
- - Working validation for the entry for the number of students covering both ends of the range
- - Working out the number of free ticket(s)
- - Calculation of total cost of tickets including consideration of free tickets
- - Calculation of actual cost per student including coach
- - Output of cost to be charged with suitable annotation
- Example
- Coach <- 550
- Ticket <- 30
- PRINT "Please enter the number of students taking part "
- INPUT NumberOfStudents
- WHILE NumberOfStudents <= 0 OR NumberOfStudent > 45
- PRINT "Your number of students is out of range, please try again"
- INPUT NumberOfStudents
- ENDWHILE
- FreeTickets <- NumberOfStudents DIV 10
- TotalCostTickets <- (NumberOfStudents - FreeTickets) * Ticket
- CostPerStudent <- (Coach + TotalCostTickets) / NumberOfStudents
- PRINT "The cost to be charged to each student is $", CostPerStudent
- [1] 1 mark for check and 1 mark for related description
- Task 1
- Many correct answers, they must relate to the pre-release task. These are examples only.
- Type/Character check to make sure only integers are entered for number of students
- Range/Limit check to make sure the number of students entered is not too large or small
- Presence check to make sure an entry has been made (for the number of students)
- Task 2
- Many correct answers, they must relate to the pre-release task. These are examples only.
- Type/Character check to make sure only letters are entered for names of students
- Length check to make sure the name entered is not too long
- Presence check to make sure an entry has been made (for a student name)
- Max 4 marks
- [1] 1 mark for appropriate test data and 1 mark for related reason
- Task 1
- Many correct answers, they must relate to the pre-release task and part (c)(i). These are examples only.
- Test data: -50 for number of students
- Reason: To check that negative values for number of students are rejected
- Task 2
- Many correct answers, they must relate to the pre-release task and part (c)(i). These are examples only.
- Test data: Smith@ for name
- Reason: To check that invalid characters are rejected in names
- Max 4 marks
- [3] Any three from:
- - Explanation of how the actual total costs are calculated - (cost of coach and cost of tickets)
- - Explanation of how the actual total income is calculated – (totalled money collected from students)
- - Explanation to show how the profit or loss is calculated – (total income - total expenditure)
- - Indicate whether a profit, break even, or loss has been made
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 →