INFORMATION TECHNOLOGY PAPER 1
GRADE 12
NOVEMBER 2017
NATIONAL SENIOR CERTIFICATE
INSTRUCTIONS AND INFORMATION
NOTE:
Candidates must use the file DataENGNov2017.exe.
Do the following:
Once extracted, the following list of files will be available in the folder DataENGNov2017:
SUPPLIED FILES
Question 1:
Pict1.png
Pict2.png
Pict3.png
Pict4.png
Pict5.png
Pict6.png
Pict7.png
Pict8.png
Pict9.png
Pict10.png
Question1_P.dpr
Question1_P.res
Question1_U.dfm
Question1_U.pas
Question 2:
DCertificate_U.pas
DigitalCertificates.txt
Question2_P.dpr
Question2_P.res
Question2_U.dfm
Question2_U.pas
Question 3:
Question3_P.dpr
Question3_P.res
Question3_U.dfm
Question3_U.pas
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
Do the following:
1.1 Tab sheet [Question 1.1]
Write code in the OnCreate event handler of the form to do the following:
Example of output when the program is executed: (3)
1.2 Tab sheet [Question 1.2]
1.2.1 Button [1.2.1 – Larger number]
Write code to do the following:
Example of output for input values 4 and 9: (4)
1.2.2 Button [1.2.2 – Swap words]
Write code to do the following:
(5)
1.3 Tab sheet [Question 1.3]
Best Buy Bakery is a small business that bakes cakes for the community.
The combo box cmbNumCakes is populated with numbers from 1 to 10, which are used to select the number of cakes to be ordered by the customer. There are ten picture files in the folder to represent the number of cakes ordered.
An image component, imgCakePic, is used to load a picture that shows the number of cakes to be ordered. Example: If the number of cakes selected is three, the name of the picture file will be Pict3.png.
1.3.1 [Combo box]
The price of a cake is saved in a constant variable called PRICE, which contains the value 159.50.
Write code for the combo box to do the following:
(5)
1.3.2 Button [1.3.2 – Calculate the amount of sugar]
A single cake requires 375 grams of sugar.
Sugar is packed in quantities of 1 kg only.
Write code to do the following:
Example of output for four cakes selected: (5)
1.4 Tab sheet [Question 1.4]
1.4.1 Radio group [Type of user]
A password is required for the owner and the staff at the bakery to use the system. The panel pnlQ1_4, where the password must be entered, is not visible to the user.
Write code to display the panel (pnlQ1_4) if Owner or Staff is selected from the radio group and to hide the panel if Customer is selected.
Example if Owner was selected from the radio group. The panel pnlQ1_4 will be visible.
(4)
1.4.2 Button [1.4.2 – Validate password]
Write code to do the following:
1.4.3 Button [1.4.3 – Encrypt password]
Write code to do the following:
Example of output for the valid password PB#87$:
(5)
1.5 Tab sheet [Question 1.5]
1.5.1 Button [1.5.1 – Perfect square]
A perfect square is the result of an integer value multiplied by itself.
Write code to enter an integer value using an InputBox. Display a message in the output area redQ1_5_1, indicating whether the number entered is a perfect square or not.
Examples of input and output:
(6)
1.5.2 Button [1.5.2 – Sequence of numbers]
Use the information given below and write code to display the following sequence of numbers:
|
TOTAL SECTION A: 55
SECTION B
QUESTION 2: OBJECT-ORIENTATED PROGRAMMING
Easy-Secure is a digital certificate-issuing authority (CA). Online traders can apply for a digital certificate. You need a program to test the validity of existing digital certificates and update information on these digital certificates on request.
Do the following:
The following user interface is displayed:
Complete the code for this program, as specified in QUESTION 2.1 and QUESTION 2.2.
2.1 The incomplete object class (TDigCertificate) contains the declaration of four attributes that describe the DCertificate object.
The attributes for the DCertificate object have been declared as follows:
NAMES OF ATTRIBUTES | DESCRIPTION |
fCertHolder | Name of the certificate holder |
fExpiryDate | Date the certificate expires |
fSecurityCode | Security code compiled using randomly selected hexadecimal values |
fIssueNr | The current issue number of the digital certificate |
The following incomplete methods have been provided:
resetExpiryDate, hasExpired and toString
NOTE: The system date is provided and saved in the string variable sSysDate in the format 'dd/mm/yyyy'.
2.1 Complete the code in the object class, as described in QUESTION 2.1.1 to QUESTION 2.1.6 below.
2.1.1 Write code for a constructor method that will receive the name of the certificate holder, the expiry date, the security code and the issue number as parameters. Assign the received parameter values to the respective attributes. (4)
2.1.2 Write code for a method called increaseIssueNr that will increase the current issue number by 1. (2)
2.1.3 Write code to complete the method called resetExpiryDate that will use the system date to reset the expiry date attribute of the digital certificate object. The expiry date must be set to one year from the current date (today's date) as it is valid for ONE year only. (4)
2.1.4 Write code to complete the method called hasExpired that will use the system date to check whether the expiry date has been reached or not and return a Boolean value. (5)
2.1.5 Write code for a method called generateSecurityCode to compile a new security code to be assigned to the fSecurityCode attribute. The code must consist of 10 randomly selected characters from the range 0–9 and A–F, grouped in pairs (two) and separated by colons.
NOTE: The final code will consist of 14 characters (10 randomly selected characters and 4 colons).
Example of security code:
9A:D3:23:C6:FA (10)
2.1.6 Write code to complete the given toString method that will return a string with attributes in the following format:
Digital certificate information:
Certificate holder: <Certificate holder>
Expiry date: <Expiry date>
Security code: <Security code>
Issue number: <Issue number> (3)
2.2 An incomplete unit Question2_U has been provided. It contains code for the object class to be accessible and have an object variable objDigCert already declared.
A text file called DigitalCertificates.txt contains a list of certificates that have been issued. The details of each certificate holder appears in the following format:
<certificate holder>;<issue number>#<expiry date># <security code>
Example of the details of the first four certificate holders in the text file:
GG Technologies;5#01/04/2016#9A:D3:23:C6:FA
JP Scrap Yard;1#01/12/2016#C5:2D:0E:66:A2
Bright Books;11#01/11/2017#18:7F:4B:CD:AA
Creative Jobs;5#01/08/2018#E0:53:CB:C4:22
The purpose of the program is to:
Follow the instructions below to code the solution.
2.2.1 Button [2.2.1 – Search certificate holder]
The user must enter the name of the certificate holder. The program must locate the name of the certificate holder in the text file called DigitalCertificates.txt.
Write code to do the following:
2.2.2 Button [2.2.2 – Display]
Information on the digital certificate object must be displayed in the redOutput area using the toString method. The output area must be cleared before displaying the information.
Example of output if Bright Books was entered as a certificate holder:
(3)
2.2.3 Button [2.2.3 – Test validity]
The digital certificate is not valid if the expiry date has been reached. Use the hasExpired method written in QUESTION 2.1.4 to determine whether the digital certificate has expired or not.
Display information of the digital certificate object in the redOutput component using the toString method.
Example of output if the digital certificate of GG Technologies has expired and they opted NOT to renew their certificate:
Example of output if GG Technologies opted to renew their digital certificate:
NOTE: The security code is randomly generated and therefore the values displayed by your program will differ from the values in the screenshots above.(8)
|
TOTAL SECTION B: 58
SECTION C
QUESTION 3: PROBLEM-SOLVING PROGRAMMING
SCENARIO
The online-shopping website of a company called MajorMax allows customers to buy items online from various departments at their store. The manager of the company must analyse their weekly sales figures.
Do the following:
Supplied GUI:
The GUI below represents the interface of the program used by MajorMax to keep track of their weekly sales figures.
Complete the code for each question, as described in QUESTION 3.1 to QUESTION 3.3.
NOTE:
The program contains code that declares two arrays, arrDepartments and arrSales.
The arrDepartments array contains the names of the various departments that sell products online.
Code declaring the arrDepartments array:
arrDepartments: array[1..8] of String = (
'PCs & Notebooks', 'Tablets & eReaders', 'Software','Printers, Toners and Ink', 'Cellphones',
'Games & Drones','Network Equipment', 'Accessories');
The arrSales array is a two-dimensional array that contains the sales figures for the first six weeks of the year for each department. The rows in the array represent the various departments and the columns represent various weeks.
Code declaring the arrSales array:
arrSales: array[1..8, 1..6] of Real = (
(935.89,965.99,4056.77,5023.89,3802.66,1146.98),
(2667.78,2491.78,1989.65,2647.88,1601.56,1921.99),
(6702.45,4271.56,3424.45,3924.55,3085.45,3359.77),
(6662.34,6658.45,8075.43,2360.66,2635.44,7365.69),
(16405.33,9741.37,13381.56,18969.76,8604.55,20207.56),
(10515.29,7582.66,9856.56,7537.68,9115.67,8401.55),
(7590.99,9212.65,9070.98,6439.99,7984.88,8767.45),
(9220.65,8097.99,10067.44,9960.87,10109.56,6571.66));
3.1 Button [3.1 – Sales information]
Display the content of the arrSales array with suitable headings in the output component provided. All monetary values must be displayed in currency format with TWO decimal places.
Example of output:
(7)
3.2 Button [3.2 – Display underperforming departments]
A report of all underperforming departments per week is required. A department is underperforming when their sales figure is lower than the average sales for all the departments for that week.
Display the report in the output component provided, with suitable headings. All monetary values must be displayed in currency format with TWO decimal places.
Example of output for the first three weeks using the original data:
(14)
3.3 Button [3.3 – New week]
Currently the data in the arrSales array represents the sales figures for the first six weeks of the year. When sales figures for a new week, for example Week 7, need to be analysed and therefore recorded in the array, the current data for Week 1 in the array must be backed up in a text file. The name of the text file is the number of the week of the sales figures that are archived. Example: If the sales figures for Week 1 are archived in the file, then the name of the text file will be 'Week 1.txt'.
When the data for Week 1 has been archived, the data for Week 2 in the arrSales array must be moved to the position of Week 1 in the array; the data for Week 3 must be moved to Week 2, and so on.
For test purposes the sales data for the new week must be randomly generated in the range R500–R5 000.
Example of output if data for a new week has been added to the array and the data of for the first week has been archived:
NOTE: The labels used to display the weeks will be updated with code to reflect the number of the new week that was added. The data that your program displays for the new week may differ from the values in the screenshot due to random values used.
Example of the contents of the 'Week 1.txt' text file:
Example of output if data for the next new week has been added to the array and the data for the second week has been archived:
Example of the contents of the 'Week 2.txt' text file:
(16)
|
TOTAL SECTION C: 37
GRAND TOTAL: 150