0% found this document useful (0 votes)
55 views3 pages

Usage of Variables and Arrays in The Solution

The document explains the usage of variables and arrays in the solution to tasks 1, 2, and 3 related to a train ticket booking system. It provides details on 8 arrays used to store information about train journeys going up and down a mountain, including departure time, available seats, passengers, and total money. It also describes 7 variables used to calculate ticket prices and totals for individual users and daily totals. Finally, it provides a link to additional expected exam questions and the GitHub repository containing the pre-release solution.

Uploaded by

konark bajaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views3 pages

Usage of Variables and Arrays in The Solution

The document explains the usage of variables and arrays in the solution to tasks 1, 2, and 3 related to a train ticket booking system. It provides details on 8 arrays used to store information about train journeys going up and down a mountain, including departure time, available seats, passengers, and total money. It also describes 7 variables used to calculate ticket prices and totals for individual users and daily totals. Finally, it provides a link to additional expected exam questions and the GitHub repository containing the pre-release solution.

Uploaded by

konark bajaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Pre-release Material P22 M/J CAIE 2021

EXPLANATION ON THE USAGE OF EACH


VARIABLE & ARRAY IN THE SOLUTION
Task 1: Usage of Variables & Arrays
1. UpTime : ARRAY[1:4]
Datatype: STRING
Usage: Used to store each train journey’s departure (leaving the foot of the mountain) hour.

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).

9. index Datatype: INTEGER


Usage: Used for FOR…TO…NEXT loop.

1|Page
Pre-release Material P22 M/J CAIE 2021

Task 2: Usage of Variables


1. FreeTickets  0
Datatype: INTEGER
Usage: Used to store the calculated number of free tickets awarded/given to the user
for the trip.

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

Task 3: Usage of Variables


1. TotalAmount  0.0
Datatype: REAL
Usage: Used to store the calculated total amount of money taken in a single day.

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

Link to the MJ 2021 PRM - Expected Questions - Variant 22.pdf file:


https://github.com/zakonweb/Pre-release-
Materials/blob/bb6aefaca06c9abca5e0da50ae8fdd1f2c813b7a/June-
2021/OL/Variant%2022/Expected%20Questions/MJ%202021%20PRM%20-%20Expected%20Questions%20-
%20Variant%2022.pdf

Link to the GitHub Paper 22 Pre-release solution Repository:


https://github.com/Dunroxiz/Pre-release-Material-2021-P22-MJ-CIE

3|Page

You might also like