INFORMATION TECHNOLOGY PAPER 1
GRADE 12
SENIOR CERTIFICATE EXAMINATIONS
MAY/JUNE2017
INSTRUCTIONS AND INFORMATION
NOTE:
Do the following:
Once extracted, the following list of files will be available in the folder DelphiDataENGJune2017/JavaDataENGJune2017:
DELPHI FILES
Question1:
NonMember.jpg
Question1_P.dpr
Question1_P.dprj
Question1_P.res
Question1_U.dfm
Question1_U.pas
Silver.jpg
Question2:
DataQ2.txt
Flight_U.pas
Question2_P.dpr
Question2_P.dprj
Question2_P.res
Question2_U.dfm
Question2_U.pas
Question3:
Question3_P.dpr
Question3_P.dprj
Question3_P.res
Question3_U.dfm
Question3_U.pas
JAVA (NETBEANS) FILES
Question1:
Gold.jpg
Platinum.jpg
Gold.jpg
NonMember.jpg
Platinum.jpg
Question1.form
Question1.java
Silver.jpg
Question2:
DataQ2.txt
Flight.java
Question2.form
Question2.java
Question3:
PopulateArrays.java
Question3.form
Question3.java
SCENARIO
A number of different software programs are used at an airport to assist staff in confirming and validating details of flights and passengers.
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
A software program is used by the airline to capture initial passenger registration information. This information is used to update the passenger profile and to assist the airline to cater for the passengers on board.
INSTRUCTIONS:
DELPHI PROGRAMMERS | JAVA PROGRAMMERS |
• Open the incomplete project file called Question1_P.dpr in the Question1 folder. • Enter your examination number as a comment in the first line of the main form unit called Question1_U.pas. | • Open the incomplete class called Question1.java in the folder Source Packages (src), Question1Package in the Question1 folder. • Enter your examination number as a comment in the first line of the class called Question1.java. |
Do the following:
Example of graphical user interface (GUI):
1.1 For the purpose of this question you may assume that all passengers are travelling on international flights. Passengers on international flights must have a valid passport and passengers younger than 16 years must be accompanied by an adult.
Write code to obtain the passenger's age from the text box provided, test whether the correct check boxes are ticked and display a suitable message to indicate whether the passenger's boarding is confirmed, or not.
Example of output if the passenger is 23 years old and has a valid passport:
Example of output if the passenger is 14 years old and has a valid passport, but is not accompanied by an adult:
Example of output if the passenger is 14 years old, has a valid passport and is accompanied by an adult:
(7)
1.2 A list box is provided with the names of different airlines and the maximum luggage weight allowed per passenger. The format of the text in the list box is as follows:
<airline name>#<maximum weight>kg
An amount of R50,00 per kilogram has to be paid if the passenger's luggage weight exceeds the maximum weight specified by the airline. The amount to be paid per kilogram has been declared as a constant in the provided code.
Write code to do the following:
Example of output if the passenger's luggage weighs 35,89 kg (35.89kg) and UKAL airline has been selected in the list box:
Example of output if the passenger's luggage weighs 12,5 kg (12.5kg) and KAA airline has been selected in the list box:
(10)
1.3 The flight catering company prepares passenger meals in advance to cater for the number of passengers on the flight. The meal options are vegetarian and non-vegetarian. The standard policy of the catering company is to prepare one third vegetarian meals and two thirds non-vegetarian meals. If the number of passengers does not divide exactly into three parts, the remaining number of meals prepared after dividing by three must be non-vegetarian.
Write code to do the following:
Example of output if there are 180 passengers:
Example of output if there are 242 passengers:
(5)
1.4 The boarding time of flights is thirty-five minutes before the time of departure. The user has to enter the time of departure in the format <hour>h<minute>.
Write code to do the following:
Example of output if the time of departure is 14h40:
Example of output if the time of departure is 17h15:
Example of output if the time of departure is invalid or entered in the incorrect format, for example 15:67:
(17)
1.5 A passenger who has a flyer card can earn points, depending on the distance travelled and whether the passenger has a silver, gold or platinum card. The list of benefits for each type of flyer card is saved as separate image files. The names of the image files are Silver.jpg, Gold.jpg, Platinum.jpg and NonMember.jpg. The default image file, NonMember.jpg, is displayed in the image component provided.
Write code to do the following:
Example of output if the distance is 1 233 kilometres and the passenger has a silver flyer card:
Example of output if the distance is 1 560 kilometres and the passenger has a gold flyer card:
(11)
TOTAL SECTION A: 50
SECTION B
QUESTION 2: OBJECT-ORIENTATED PROGRAMMING
Airlines store details of flights and passengers to assist staff in verifying information promptly.
Do the following:
DELPHI PROGRAMMERS | JAVA PROGRAMMERS |
• Open the incomplete project file called Question2_P.dpr and the class called Flight_U.pas • Enter your examination number as a comment in the first line of both files Question2_U.pas and Flight_U.pas. | • Open the incomplete classes called Question2.java and Flight.java in the folder Source Packages (src), Question2Package. • Enter your examination number as a comment in the first line of both classes Question2.java and Flight.java. |
2.1 A partially completed object class called TFlight/Flight has been provided. It contains the attributes of a flight and the code for one method.
Complete the code in the given flight class called TFlight/Flight, as described in QUESTION 2.1.1 to QUESTION 2.1.6 that follow.
The table below contains descriptions of the attributes of a flight object.
NAMES OF ATTRIBUTES | DESCRIPTION | |
Delphi | JAVA | |
flightNumber | fFlightNumber | Flight number |
fCity | city | Name of the destination city |
fDate | date | Date of the flight in the format YYYY/MM/DD |
fNumPassengers | numPassengers | Number of passengers booked on the flight |
2.1.1 Write code for a constructor to do the following:
2.1.2 Write accessor methods for the fFlightNumber/flightNumber and fNumPassengers/numPassengers attributes. (4)
2.1.3 Write a method called increasePassengers to increase the attribute of the number of passengers by 1. (2)
2.1.4 Write a method called calcPercBooked that will receive the maximum number of passengers for the flight as a parameter and calculate and return the percentage of seats booked.
Use the formula:
passengers booked / maximum number of passengers * 100 (4)
2.1.5 Write a toString method to display the details of a flight in the following format:
Flight number: <flight number>
Destination: <city>
Departure date: <date>
Number of passengers booked: <number of passengers booked>
Example of output:
(5)
2.2 Graphical user interface (GUI):
Data supplied:
A text file called DataQ2.txt has been supplied. Each line of text in the file contains data of a passenger booked for a flight in the following format:
<flight number>-<passenger number>four spaces<passenger name>
Example of the first six lines of text stored in the text file:
SA528-01 Gregory Thomas SA528-02 Henry Kensington MA230-01 Sebastian Johnson KU137-01 Henrietta Botha BA630-01 Samson Nduli BA630-02 Mary Nduli |
The data in the first two lines of text can be interpreted as follows:
Line 1: On flight SA528, the name of passenger number 1 is Gregory Thomas
Line 2: On flight SA528, the name of passenger number 2 is Henry Kensington
Do the following to complete the code for the buttons in the main form unit (Delphi)/GUI class (Java) as described below.
NOTE: The object objFlight has been declared in the program.
2.2.1 Button [Question 2.2.1]
A combo box containing the details of the different flights is given.
The contents of the combo box is as follows:
The format of each line of text in the combo box is as follows:
<flight number>#<destination city>#<date of flight>
The data in the first line of the combo box can be interpreted as follows:
Line 1: Flight SA528 to Johannesburg will depart on 2017-07-22.
The user must select a flight from the combo box.
Write code to do the following:
2.2.2 Button [Question 2.2.2]
Write code to do the following:
Example of output for flight MA230 to Cape Town:
(15)
2.2.3 Button [Question 2.2.3]
Use a dialog box to ask the user to enter the maximum number of passengers for the flight. Use the calcPercBooked method to determine the percentage of seats booked for the flight. Display a suitable message if the flight is fully booked, for example:
If the flight is NOT fully booked, display the booking percentage to ONE decimal place and use a dialog box to enter the name a new passenger. The new passenger's details must be saved to the text file and the number of passengers booked must be updated. The updated information must be displayed in the output area.
The format of all lines in the text file DataQ2.txt must be as follows:
<flight number>-<passenger number>4 spaces<passenger name>
NOTE: The first passenger on a flight has the number 01, the second passenger has the number 02, and so on.
Example of input from the user and output if flight MA230 is selected, the maximum number of passengers is 50 and the flight is not fully booked. Graham Barkley is added as a passenger to the flight:
(13)
TOTAL SECTION B: 60
SECTION C
QUESTION 3: PROBLEM-SOLVING PROGRAMMING
The new airline company, Soaring Eagles, wants to optimise the check-in process of their passengers. The number of counters that will be opened and manned by their staff will depend on the number of customers in the queue. If a flight is delayed, the passengers on the delayed flight will be requested to queue at a separate counter.
Do the following:
DELPHI PROGRAMMERS | JAVA PROGRAMMERS |
• Open the incomplete project file called Question3_P.dpr in the Question3 folder. • Enter your examination number as a comment in the first line of the main form unit called Question3_U.pas. | • Open the incomplete class called Question3.java in the folder Source Packages (src), Question3Package in the Question3 folder. • Enter your examination number as a comment in the first line of the class called Question3.java. |
Read the following sections before attempting the solution:
NOTE:
Supplied graphical user interface (GUI):
The supplied GUI contains components for events that need to take place.
Use the program requirements in the questions that follow to decide on a suitable output component to be placed in the output area labelled Airline counters in the GUI.
Supplied data:
A one-dimensional array called arrPassengers has been declared and will contain the information of passengers who must collect their boarding passes at the check-in counters at the airport. Supplied code will populate the arrPassengers array with an unknown number of elements obtained from the arrPosPassengers array when the program is executed. The number of elements allocated to the arrPassengers array will be in the range from 1 to 35 and will be determined randomly.
You must use the arrPassengers array in your code.
The format of the data in the arrPassengers array is as follows:
(B – business class or E – economy class), the position of the passenger in the queue (starting at 01) and the flight number, as shown below:
<Passenger class><position of passenger in the queue>;<flight number>
Example of passenger information in the arrPassengers array:
E01;TDB2506
B02;TDB2506
E01;TDB1305
A two-dimensional array called arrGrid with nine rows and four columns has been declared. In your solution this array will not necessarily contain 36 elements, as the number of passengers contained in the arrPassengers array will determine the number of elements contained in the arrGrid array.
Program requirements:
3.1 Button [3.1 – Queues at check-in counters]
The program must place the passengers waiting for their boarding passes (contained in the arrPassengers array) in queues at the check-in counters. The number of passengers contained in the arrPassenger array determines the number of open check-in counters by using the following criteria:
NUMBER OF OPEN CHECK-IN COUNTERS | NUMBER OF PASSENGERS TO RECEIVE BOARDING PASSES |
1 | Less than 10 |
2 | 10 to 16 |
3 | 17 to 24 |
4 | More than 24 |
Do the following:
Example of output if 16 passengers are waiting to receive boarding passes:
Example of output if 33 passengers are waiting to receive boarding passes:
NOTE: The output is determined by the number of elements that the arrPassengers array contains.
3.2 Button [3.2 – Passengers on delayed flight]
When a flight is delayed the passengers booked on the delayed flight must be removed from the queues at the open check-in counters and placed in a queue at a separate counter. A combo box with flight numbers is provided to select the flight number of a delayed flight.
The user must select the delayed flight and click on the QUESTION 3.2 button.
The program must do the following:
Example of output if flight TDB2506 was selected from the combo box as a delayed flight and the arrPassengers array contains 33 elements:
Mark allocation:
REQUIREMENTS | MAXIMUM MARKS |
QUESTION 3.1 | |
Determine number of open counters and number of passengers per row | 6 |
Allocate position according to passenger class | 5 |
Copy information from given array to correct data structure | 8 |
Display passengers in queues at correct number of counters | 7 |
QUESTION 3.2 | |
Determine and display passengers on the delayed flight | 6 |
Remove passengers on delayed flight from queues | 6 |
Update information in data structures and output | 2 |
TOTAL SECTION C:40
GRAND TOTAL:150