Uploaded by Tareq Zabara

IGCSE CS Exam: Bus Punctuality Data Analysis

advertisement
Mr. Mahmoud Moussa
IGCSE CS 0984
The local high school uses buses to transport students to school. There are six bus routes labelled
A to F. You have conducted a survey to analyse the punctuality statistics of these buses over one
week period.
A one-dimensional (1D) array Days[] contains the names of the days of the week.
A two-dimensional (2D) array BusRoute[] is used to store data about each route.
The data from the survey are shown in the table:
Bus A Bus B Bus C Bus D Bus E Bus F
0
0
2
1
-1
0
0
0
1
0
-1
5
-2
0
1
-3
0
1
0
0
1
-3
0
1
1
0
0
0
0
-5
Positive numbers represent minutes early, negative numbers represent minutes late and 0 represents
the bus having been on time.
The data for the days are:
MON
TUE
WED
THU
FRI
The position of any day’s data is the same in all 2 arrays. For example, if Wednesday is in index 3
of Days[], Wednesday’s bus routes data are in index 3 of BusRoute[]
Write a program that meets the following statistics for the one-week period:
▪
calculated and output the number of late arrivals for each bus route
▪
the bus route with the highest number of days on which it was late
▪
Allow the user to input a specific day, for example FRI, to be used for analysis of data.
▪
Find and display how many buses were late on this particular day
▪
For each late bus, display the route label and how late the bus was on this particular day.
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to declare and initialise the data in the global array BusRoute
All inputs and outputs must contain suitable messages.
You will need to initialise and populate the array Days[] at the start of the program.
www.mahmoudmoussa.com
1
Mr. Mahmoud Moussa
IGCSE CS 0984
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
www.mahmoudmoussa.com
2
Mr. Mahmoud Moussa
IGCSE CS 0984
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
www.mahmoudmoussa.com
3
Mr. Mahmoud Moussa
IGCSE CS 0984
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
…………………………………………………………………………………………………………
www.mahmoudmoussa.com
4
Download