This repository contains the pseudocode and python solution for CIE pre-release material 2021 Paper 22 May/June.
The pseudocode solution is written using the Pseudocode Guide for Teachers given by Cambridge.
To the best of my ability, I have completed all the requirements given for the three tasks.
I also have tried my best to correct any errors found in my solution. If you do find any errors please let me know, Thank you.
If you have any suggestions regarding the solution. Please feel free to share them.
Files in this repository:
- Explanation of the Solution [folder]
- Usage of Variables and Arrays in the Solution.docx
- Usage of Variables and Arrays in the Solution.md
- Usage of Variables and Arrays in the Solution.pdf
- Pre-release material and Pseudocode Guide [folder]
- 0478_pseudocode_guide.pdf
- 2210_S21_PM_22.pdf
- Pseudocode and Python Solutions [folder]
- PRM-2021-P22-MJ-pseudocode.docx
- PRM-2021-P22-MJ-pseudocode.pdf
- PRM-2021-P22-MJ-pseudocode.txt
- PRM-2021-P22-MJ-python solution.py
- CHANGELOG.md
- README.md
This Solution is not wholly written by me. I have taken help from other solutions as well and produced one solution that I have found best.
Provided by Dunroxiz
IN NO EVENT SHALL THE AUTHOR(s) OF THE PRE-RELEASE SOLUTION PROVIDED IN THIS REPOSITORY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ARISING FROM, OUT OF OR IN CONNECTION WITH THE PRE-RELEASE SOLUTION PROVIDED IN THIS REPOSITORY OR THE USE OR OTHER DEALINGS IN THE PRE-RELEASE SOLUTION PROVIDED IN THIS REPOSITORY.
Your preparation for the examination should include attempting the following practical tasks by writing
and testing a program or programs.
An electric mountain railway makes four return trips every day. In each trip the train goes up the
mountain and back down. The train leaves from the foot of the mountain at 09:00, 11:00, 13:00 and
15:00. The train returns from the top of the mountain at 10:00, 12:00, 14:00 and 16:00. Each train has
six coaches with eighty seats available in each coach. Passengers can only purchase a return ticket;
all tickets must be purchased on the day of travel. The cost is $25 for the journey up and $25 for the
journey down. Groups of between ten and eighty passengers inclusive get a free ticket for every tenth
passenger, provided they all travel together (every tenth passenger travels free). Passengers must
book their return train journey, as well as the departure train journey, when they purchase their ticket.
Passengers can return on the next train down the mountain or a later train. The last train from the top
of the mountain has two extra coaches on it.
The train times are displayed on a large screen, together with the number of tickets still available for
each train. Every time a ticket is booked the display is updated. When a train is full, the word ‘Closed’ is
displayed instead of the number of tickets available.
Write and test a program or programs for the electric mountain railway.
- Your program or programs must include appropriate prompts for the entry of data; data must be validated on entry.
- Error messages and other output need to be set out clearly and understandably.
- 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 – Start of the day.
Write a program to set up the screen display for the start of the day. Initialise suitable data structure(s)
to total passengers for each train journey and total the money taken for each train journey. Each train
journey must be totalled separately. There are four journeys up and four journeys down every day.
Task 2 – Purchasing tickets.
Tickets can be purchased for a single passenger or a group. When making a purchase, check that the
number of tickets for the required train journeys up and down the mountain is available. If the tickets
are available, calculate the total price including any group discount. Update the screen display and the
data for the totals.
Task 3 – End of the day.
Display the number of passengers that travelled on each train journey and the total money taken for
each train journey. Calculate and display the total number of passengers and the total amount of money
taken for the day. Find and display the train journey with the most passengers that day.