Usage of Variables and Arrays in The Solution
Usage of Variables and Arrays in The Solution
2. UpSeats : ARRAY[1:4]
Datatype: INTEGER
Usage: Used to store the total number of tickets available for each train journey going up
the mountain (leaving the foot of the mountain).
3. UpPassengers : ARRAY[1:4]
Datatype: INTEGER
Usage: Used to store the total number of passengers travelled on each train journey going
up the mountain (leaving the foot of the mountain).
4. UpMoneyTotal : ARRAY[1:4]
Datatype: REAL
Usage: Used to store the total money taken for each train journey going up (leaving the
foot of the mountain).
5. DownTime : ARRAY[1:4]
Datatype: STRING
Usage: Used to store each train journey’s return hour (going down to the foot of mountain
hour).
6. DownSeats : ARRAY[1:4]
Datatype: INTEGER
Usage: Used to store the total number of tickets available for each train journey going down
(returning to the foot of mountain).
7. DownPassengers : ARRAY[1:4]
Datatype: INTEGER
Usage: Used to store the total number of passengers travelled on each train journey going
down (returning to the foot of mountain).
8. DownMoneyTotal : ARRAY[1:4]
Datatype: REAL
Usage: Used to store the total money taken for each train journey going down (returning to
the foot of mountain).
1|Page
Pre-release Material P22 M/J CAIE 2021
2. OneWayTicket 25.0
Datatype: CONSTANT REAL
Usage: Used to store the fixed price of one ticket. This variable is a constant.
3. OneWayCost 0.0
Datatype: REAL
Usage: Used to store the calculated one-way journey price for the trip.
4. choice
Datatype: BOOLEAN
Usage: Used to store the user input when asked if wants to buy ticket(s) or not.
5. NumOfPassengers
Datatype: INTEGER
Usage: To store the user input when asked for the number of passengers going on
the trip.
6. UpTrip
Datatype: INTEGER
Usage: To store user input when asked for the Journey number corresponding to
chosen departure hour (leaving the foot of the mountain hour).
7. DownTrip
Datatype: INTEGER
Usage: To store user input when asked for the Journey number corresponding to
chosen return hour.
8. index
Datatype: INTEGER
Usage: Used for FOR…TO…NEXT loop
2|Page
Pre-release Material P22 M/J CAIE 2021
2. TotalPassengers 0
Datatype: INTEGER
Usage: Used to store the total number of passengers travelled in a single day.
3. MostPassengers 0
Datatype: INTEGER
Usage: Used to store the greatest number of passengers travelled on a journey to
help find the Journey hour with the greatest number of passengers.
4. MaxTrain
Datatype: STRING
Usage: Used to store the Journey hour with the greatest number of passengers.
5. index
Datatype: INTEGER
Usage: Used for FOR…TO…NEXT loop
For expected questions that can come in your exam for Paper 22
Check out this document created by Zafar Ali Khan
3|Page