INFORMATION TECHNOLOGY PAPER 1
GRADE 12
SENIOR CERTIFICATE EXAMINATIONS
MAY/JUNE2017

INSTRUCTIONS AND INFORMATION

  1. This question paper is divided into THREE sections. Candidates must answer ALL THREE sections.
  2. The duration of this examination is three hours. Because of the nature of this examination it is important to note that you will not be permitted to leave the examination room before the end of the examination session.
  3. This question paper is set with programming terms that are not specific to any particular programming language (Delphi/Java (using the Netbeans IDE)).
  4. Make sure that you answer the questions according to the specifications that are given in each question. Marks will be awarded according to the set requirements.
  5. Answer only what is asked in each question. For example, if the question does not ask for data validation, then no marks will be awarded for data validation.
  6. Your programs must be coded in such a way that they will work with any data and not just the sample data supplied or any data extracts that appear in the question paper.
  7. Routines, such as search, sort and selection, must be developed from first principles. You may NOT use the built-in features of a programming language for any of these routines.
  8. All data structures must be defined by you, the programmer, unless the data structures are supplied.
  9. You must save your work regularly on the disk/CD/DVD/flash disk you have been given, or on the disk space allocated to you for this examination session.
  10. Make sure that your examination number appears as a comment in every program that you code, as well as on every event indicated.
  11. If required, print the programming code of all the programs/classes that you completed. You will be given half an hour printing time after the examination session.
  12. At the end of this examination session you must hand in a disk/CD/DVD/flash disk with all your work saved on it OR you must make sure that all your work has been saved on the disk space allocated to you for this examination session. Ensure that all files can be read.
  13. The files that you need to complete this question paper have been given to you on the disk/CD/DVD/flash disk or on the disk space allocated to you. The files are provided in the form of password-protected executable files.

NOTE:

  • Delphi candidates must use the file DelphiDataENGJune2017.exe.
  • Java candidates must use the file JavaDataENGJune2017.exe.

Do the following:

  • Double click on the password-protected executable file.
  • Click on the extract button.
  • Enter the following password: AiR%$Port

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:

  • Compile and execute the program. The graphical user interface (GUI) displays five sections named Question 1_1 to Question 1_5. Currently the program has no functionality.
  • Complete the code for the program, as described in QUESTION 1.1 to QUESTION 1.5 on the next page.

Example of graphical user interface (GUI):
Ex1
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:
1.1
Example of output if the passenger is 14 years old and has a valid passport, but is not accompanied by an adult:
1.1b
Example of output if the passenger is 14 years old, has a valid passport and is accompanied by an adult:
1.1c(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:

  • Obtain the passenger's luggage weight from the text box and the maximum luggage weight allowed for the airline selected from the list box.
  • Use the information obtained to calculate the excess weight, if any.
  • Use the constant variable and the calculated excess weight to determine the cost of the excess weight of the passenger's luggage.
  • Display the excess weight and the cost of the excess weight. The cost must be formatted to a currency with TWO decimal places.

Example of output if the passenger's luggage weighs 35,89 kg (35.89kg) and UKAL airline has been selected in the list box:
1.2
Example of output if the passenger's luggage weighs 12,5 kg (12.5kg) and KAA airline has been selected in the list box:
1.2b(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:

  • Obtain the number of passengers from the text box provided.
  • Determine and display the number of vegetarian meals and the number of non-vegetarian meals that must be prepared for the passengers.

Example of output if there are 180 passengers:
1.3
Example of output if there are 242 passengers:
1.3b(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:

  • Obtain the time of departure from the text box provided.
  • Validate the time of departure to ensure that the following applies:
    • The format must be <hour>h<minute>.
    • The hour value must be less than or equal to 23 and must consist of two digits.
    • The minute value must be less than or equal to 59 and must consist of two digits.
  • If the time of departure is invalid, use a dialog box to display a suitable message and clear the time of departure text box.
  • If the time of departure is valid, calculate and display the boarding time in the text box provided.

Example of output if the time of departure is 14h40:
1.4
Example of output if the time of departure is 17h15:
1.4b
Example of output if the time of departure is invalid or entered in the incorrect format, for example 15:67:
1.4c(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:

  • Obtain the distance travelled from the text box provided.
  • Select the type of flyer card from the radio buttons provided.
  • Display the corresponding image file for the flyer card selected.
  • Calculate the points earned as follows:
  • All card passengers will earn one point for every 1,6 kilometres travelled.
  • Gold card passengers will earn additional bonus points, calculated at 15% of the distance travelled.
  • Platinum card passengers will earn additional bonus points, calculated at 20% of the distance travelled.
  • The total points must be rounded down to the nearest whole number.
  • The panel named pnlPoints must be shown if a card was selected. The total points earned must be displayed in this panel.

Example of output if the distance is 1 233 kilometres and the passenger has a silver flyer card:
1.5
Example of output if the distance is 1 560 kilometres and the passenger has a gold flyer card:
1.5b(11)

  • Enter your examination number as a comment in the first line of the program file.
  • Save your program.
  • Make a printout of the code if required.

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.
  • Complete the code for this program as specified in QUESTION 2.1 and QUESTION 2.2 below.

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:

  • Receive the flight number, destination city and date of the flight as parameters.
  • Assign the relevant parameter values to the respective attributes.
  • Call the given setNumPassengers method to set the fNumPassengers/NumPassengers attribute to 0. (5)

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:
2.15(5)
2.2 Graphical user interface (GUI):
2.2
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:
2.21
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:

  • Use the selected flight details to instantiate the object objFlight.
  • Enable the buttons for QUESTION 2.2.2 and QUESTION 2.2.3.
  • Display a message to indicate that the flight object has been instantiated.
    Example of output:
    2.21b(12)

2.2.2 Button [Question 2.2.2]
Write code to do the following:

  • Check whether or not the DataQ2.txt text file exists.
  • If the text file does NOT exist, display a suitable message and close the program.
  • Do the following if the text file exists:
    • Loop through the file.
  • Read a line of text (passenger details) in the file.
    If the passenger read in the file is on the selected flight:
      • Display the line of text as read in the text file.
      • Use the increasePassengers method to update the number of passengers.
    • Use the toString method to display the updated information of the flight.

Example of output for flight MA230 to Cape Town:
2.22(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:
2.23
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:
2.23b(13)

  • Enter your examination number as a comment in the first line of the class and the form.
  • Save your program.
  • Print the code contained in both the class and the form if required.

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:

  • GUI and data supplied
  • Program requirements
  • Mark allocation

NOTE:

  • You may NOT modify data supplied manually. Code must be added to manipulate the data supplied according to the requirements.
  • The use of good programming techniques and modular design must be applied in the design and coding of your solution.

Supplied graphical user interface (GUI):
The supplied GUI contains components for events that need to take place.
gui
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:

  • Use the arrGrid two-dimensional array to represent the open check-in counters and passengers allocated to these counters. Passengers must be allocated to counters as follows:
    • Business class passengers must be placed first in the queues at the check-in counters, followed by economy class passengers.
    • The passengers must be distributed as evenly as possible amongst the queues at the check-in counters, as shown in the examples of output that follow.
  • Display suitable headings for the check-in counters.
  • Display the class and number of the passengers.

Example of output if 16 passengers are waiting to receive boarding passes:
ex16
Example of output if 33 passengers are waiting to receive boarding passes:
ex33
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:

  • Remove the information of all passengers booked on the delayed flight from the queues at the check-in counters and display their details in the output area provided.
  • Update the display of the queues at the check-in counters. The passengers at the check-in counters must still be distributed evenly amongst the counters; first the business class passengers and then the economic class passengers.

Example of output if flight TDB2506 was selected from the combo box as a delayed flight and the arrPassengers array contains 33 elements:
3.2

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
  • Enter your examination number as a comment in the first line of the program file.
  • Save your program.
  • Make a printout of the code if required.

TOTAL SECTION C:40
GRAND TOTAL:150

Last modified on Friday, 13 August 2021 11:50