A train runs from the airport to the city centre - Edexcel - GCSE Computer Science - Question 5 - 2020 - Paper 1
Question 5
A train runs from the airport to the city centre. Passengers purchase tickets from a ticket machine at the station. Journeys must start within two hours of purchasin... show full transcript
Worked Solution & Example Answer:A train runs from the airport to the city centre - Edexcel - GCSE Computer Science - Question 5 - 2020 - Paper 1
Step 1
Input: Current time
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
To calculate the expiry time, the current time is used as the starting point. The expiry time is then determined by adding a set duration (e.g., 2 hours) to the current time.
Step 2
Process: Calculate expiry time
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The expiry time is calculated using the formula:
ExpiryTime=CurrentTime+2exthours
This ensures that the ticket remains valid for two hours from the time of purchase.
Step 3
Output: Expiry time
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The output is the calculated expiry time, which shows the time until the ticket expires, allowing passengers to plan their journey accordingly.
Step 4
Input: Payment
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The payment process involves receiving coins and notes from the user. The input is validated to ensure the correct amount is received.
Step 5
Process: Ticket
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Once the payment has been validated and processed, a ticket is generated and printed for the user. The machine also calculates the change to be returned based on the payment provided.
Step 6
Output: Change
97%
121 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The output is the amount of change that the user receives after the ticket purchase, ensuring that the transaction is completed correctly.