INFORMATION TECHNOLOGY PAPER 1
GRADE 12
NATIONAL SENIOR CERTIFICATE EXAMINATIONS
MAY/JUNE 2019
INSTRUCTIONS AND INFORMATION
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
Do the following:
Example of the graphical user interface (GUI):
Follow the instructions below to complete the code for EACH section of QUESTION 1, as described in QUESTION 1.1 to QUESTION 1.4.
1.1 Button [1.1 - Random number] Write code to do the following:
1.2 Button [1.2 - Calculate minutes] A school dance has many learners participating. The organisers need to determine how long it will take to introduce all the participants. The time allocated to introduce each participant will depend on the total number of participants. The following criteria will be used:
Number of participants | Number of minutes per participant |
Less than or equal to 20 | 2.5 minutes |
More than 20 and less than or equal to 50 | 2.3 minutes |
More than 50 | 2.0 minutes |
The user must enter the number of participants in the edtParticipants edit box. Write code to do the following:
Use the following test data:
Number of participants | Minutes | Minutes rounded |
13 | 32.50 | 33 |
21 | 48.3 | 49 |
50 | 115.00 | 115 |
51 | 102.00 | 102 |
Example of output if the number of participants is 17:
(13)
1.3 Button [1.3 - Calculate factorial]
The factorial of a number is the product of multiplying all integers from 1 to the number, e.g.
The factorial of 4 = 1 x 2 x 3 x 4
= 24
The factorial of 6 = 1 x 2 x 3 x 4 x 5 x 6
= 720
The user must select a number from the spnNumber spin edit box. Write code to extract the number from the spnNumber spin edit box, calculate the factorial of the number and display the result in the edtFactorial edit box. Example of output if the number 5 is selected: (7)
1.4 Button [1.4 - Reverse words]
The characters in words in a sentence must be reversed for encryption purposes. The user must enter a sentence in the edtSentence edit box. Write code to do the following:
Example of input and output: (16)
TOTAL SECTION A: 40
SECTION B
QUESTION 2: DATABASE PROGRAMMING
PJB Wholesale Garden Centre supplies plants to a number of nurseries. When a quotation for an order is given, the requested number of plants is checked for availability.
The database NurseryDB for PJB Wholesale Garden Centre contains two tables, namely tblPlants and tblOrders.
The data pages attached at the end of this question paper provide information on the design of the database and examples of the contents of the tables.
Do the following:
NOTE: If the compiler shows an error message with regard to the given CurrencyString statement, remove the statement.
The following user interface is displayed:
NOTE:
Variable | Data type | Description |
tblPlants | TADOTable | Refers to the table tblPlants |
tblOrders | TADOTable | Refers to the table tblOrders |
2.1 Tab sheet [Question 2.1 - SQL]
In this section you may use ONLY SQL statements to answer QUESTION 2.1.1 to QUESTION 2.1.5.
Code to execute the SQL statements and display the results of the queries is provided. The SQL statements are incomplete.
The following GUI is displayed:
Do the following:
Enter the SQL statements for QUESTION 2.1.1 to QUESTION 2.1.5 which is assigned to the variables sSQL1, sSQL2, sSQL3, sSQL4 and sSQL5 respectively.
2.1.1 Button [2.1.1 - List of roses]
Display all the details of the plants in the Rose category in the tblPlants table.
Example of output of the first five records: (3)
2.1.2 Button [2.1.2 - Pink roses and flowers]
Display the PlantCode, Category, Colour and SizeOfPot fields from the tblPlants table for all the plants in the Flower and Rose categories that have any type of pink colour.
Example of output of the last five records: (6)
2.1.3 Button [2.1.3 - Average price per category]
Use data from the tblPlants table to determine the average price for plants per category using AveragePrice as the new field name for the calculated field. The average price should be displayed in currency format.
Example of output: (5)
2.1.4 Button [2.1.4 - Display information for invoice number F2]
The invoice number will be the same for all items of a specific order.
Display the InvoiceNum, Description and NumberOrdered fields of all items ordered in the tblOrders table for invoice number F2.
Example of output: (5)
2.1.5 Button [2.1.5 - Update items delivered]
The number of items delivered differs sometimes from the number of items ordered in the table tblOrders.
Once an outstanding delivery has been made, the user must enter the item number (ItemNum) for the delivery that has been made. Write an SQL statement for variable sSQL5 to modify the NumDelivered field to contain the same value as the NumberOrdered field.
NOTE: Code is provided to request the user to enter the item number.
Example of output for item number 6 before the record was modified:
Example of output for item number 6 after the record had been modified: (4)
2.2 Tab sheet [Question 2.2 - Delphi code]
Use only programming code in this section to answer QUESTION 2.2.1 to QUESTION 2.2.2.
NO marks will be awarded for SQL statements in QUESTION 2.2.
The GUI for QUESTION 2.2 is shown below.
NOTE: The variables iNumOrdered and sPlantCode are provided as global variables. The content of these variables must be used in QUESTION 2.2.1 to check the availability of stock and in QUESTION 2.2.2 to place the order.
2.2.1 Button [2.2.1 - Check stock]
The stock available must be checked before an order can be placed.
The user must do the following:
Code is provided to populate the combo box (cmbPlantCode) containing the plant code associated with the selected category.
Code is provided to:
Write code to determine whether or not there is enough stock available.
Example of output if a request for 125 plants with code DIP002#M from the Creeper category was entered:
Example of output if a request for 225 plants with code DIP002#M from the Creeper category was entered with only 183 plants with this code being available:
Example of output if a request for 225 plants with code DIP002#M from the Creeper category was entered and the user does NOT want to place the order: (11)
2.2.2 Button [2.2.2 - Place an order]
An order must be placed in the tblOrders table using the following information:
Example of output when placing an order for 125 plants with plant code DIP002#M: (6)
TOTAL SECTION B: 40
SECTION C
QUESTION 3: OBJECT-ORIENTATED PROGRAMMING
Star Nursery invites learners from the local schools to a voluntary training programme as part of a community initiative. Learners who are used as trainees must attend training sessions to enable them to assist customers with enquiries and with the sale of plants.
Do the following:
Example of graphical user interface (GUI) that will be displayed:
The program will use the number of hours of the training and the value of the sales made to determine whether or not the trainee qualifies for a bonus.
Complete the code as specified in QUESTION 3.1 for the Trainee_U object class and QUESTION 3.2 for the Question3_U form class.
3.1 The incomplete object class (TTrainee) provided contains code for the following:
The attributes for the Trainee object have been declared as follows:
Names of attributes | Description |
fTraineeID | Unique number to identify the trainee |
fName | Name and surname of the trainee |
fHours | Number of hours of training the trainee attended |
fSales | Amount of the sales the trainee made |
3.1.1 The number of hours of training attended by the trainee and the amount of the sales made can be increased.
3.1.2 Write code for a method called qualifiesForBonus. The method must return a Boolean value TRUE if the trainee qualifies for a bonus or FALSE if the trainee does not qualify for a bonus.
A trainee qualifies for a bonus if the following conditions are met:
3.1.3 Write code to complete the provided toString method to return a string in the following format:
<name and surname of the trainee> (<the trainee ID>) attended <number of hours of training attended> hours of training and sold plants to the value of <value of the plants sold formatted to currency and two decimals>. |
Example of output when the toString method is called: (4)
3.2 The incomplete unit Question3_U has been provided which contains code for the object class to be accessible. An object variable called objTrainee has been declared.
A text file called Logbook.txt contains the log entries of all the training and sales activities of the trainees.
Each log entry contains information of a trainee in the following format:
<trainee ID>;<character T or S indicating training or a |
Example of the first four entries in the text file:
12;T#0.98 15;S#182.00 13;S#118.00 10;T#1.96 |
The first two lines of text can be interpreted as follows:
Follow the instructions below to code the solution:
3.2.1 Button [3.2.1 - Click to continue]
The user must select the name of a trainee from the cmbTrainee combo box. Code is provided to do the following:
Write code to do the following:
Example of the GUI if Kody Shaw is selected as the trainee and the 'Click to continue' button is clicked.
3.2.2 Button [3.2.2 – Process logbook data]
Write code to do the following:
If the trainee's ID is found, do the following:
Once all the data from the text file has been processed, do the following:
If the trainee's ID number could NOT be found in the text file, display the message 'The trainee is not registered.' in the output area.
Example of output if trainee Kody Shaw is selected and the logbook data is processed:
Example of output if trainee Lindiwe Dlamini is selected and the logbook data is processed: (18)
3.2.3 Button [3.2.3 - Qualifies for a bonus?]
Write code to do the following:
Example of output for trainee Kody Shaw:
Kody Shaw (10) attended 65.66 hours of training and |
Example of output for trainee Tyrone Kemsley:
Tyrone Kemsley (12) attended 65.66 hours of training and sold plants to the value of R 1 078.00. The trainee does NOT qualify for a bonus. (3) |
TOTAL SECTION C: 40
SECTION D
QUESTION 4: PROBLEM-SOLVING PROGRAMMING
SCENARIO
The trees at the nursery are categorised using the types Citrus, Deciduous, Nut and Tropical.
Do the following:
The GUI shown below is displayed.
The program contains code of the following for the declaration:
The format of the code in the array that represents each tree is as follows:
<tree name>#<first letter of tree type>
arrList: array[1..24] of String = (
'Orange#C','Hazelnut#N','Apple#D',
'Banana#T','Pecan#N','Pear#D',
'Lemon#C','Papaya#T','Kiwi#T',
'Apricot#D','Grapefruit#C','Walnut#N',
'Lime#C','Mango#T','Peach#D',
'Cashew#N','Almond#N','Tangerine#C',
'Avocado#T','Cherry#D','Plum#D',
'Macadamia#N','Kumquat#C','Guava#T');
The first two entries in arrList array can be explained as follows:
Orange#C means the tree name is Orange and the tree type is Citrus.
Hazelnut#N means the tree name is Hazelnut and the tree type is Nuts.
NOTE:
Complete the code for EACH section of QUESTION 4, as described in QUESTION 4.1 to QUESTION 4.3 below.
4.1 Button [4.1 - Separate by type]
The data in the arrList array must be stored in the two-dimensional array arrTrees by row according to the types of trees, e.g. the data of the citrus trees must be stored in row 1, the deciduous trees in row 2, the nut trees in row 3 and the tropical trees in row 4.
Use the arrTypes array to determine the row value where the data of the tree must be stored in the arrTrees array, e.g. if the data string is 'Orange#C', then the tree is of type 'Citrus' and the data string 'Orange#C' must be stored in row 1. If the data string is 'Hazelnut#N', then the tree is of type 'Nuts' and the data string must be stored in row 3, and so on.
Write code to do the following:
4.2 Button [4.2 - Display]
Write code to display the types of trees contained in the arrTypes array and the trees corresponding with the types of trees from the arrTrees array.
Example of output: (7)
4.3 Button [4.3 - Sort alphabetically]
The trees in the arrTrees array must be sorted alphabetically as per tree type, e.g. citrus trees will appear as follows in row 1 of the arrTrees array:
Grapefruit Kumquat Lemon Lime Orange Tangerine
Write code to do the following:
Example of output: (12)
TOTAL SECTION D: 30
GRAND TOTAL: 150
INFORMATION TECHNOLOGY
DATABASE INFORMATION FOR QUESTION 2:
The design of the database tables is as follows:
Table: tblPlants
This table contains a price list of all the stock in PJB Wholesale Garden Centre.
Field name | Data type | Description |
PlantCode | Text (13) | A unique code assigned to each plant item |
Description | Text (35) | The description of each plant item |
Category | Text (12) | Category of the plant item |
SizeOfPot | Text (4) | The pot size of the plant indicated with S, M, L, XL, XXL and XXXL |
Colour | Text (20) | Colour of the flowers |
Price | Currency | Selling price of the plant |
InStock | Integer | Number of plants in stock |
Example of data of the first ten records:
Table: tblOrders
This table contains the records of orders that were placed.
Field name | Data type | Description |
ItemNum | AutoNumber | A unique number assigned to an item in an order |
InvoiceNum | Text (3) | Every order receives an invoice number. An order may contain multiple items |
PlantCode | Text (13) | The code of the plant ordered – foreign key |
NumberOrdered | Integer | Number of plants of a specific item ordered |
NumberDelivered | Integer | Number of plants of a specific item delivered |
Example of data of the first ten records:
The following one-to-many relationship with referential integrity exists between the two tables in the database: