Information Technology P1 May-June 2021 Eng
Information Technology P1 May-June 2021 Eng
INFORMATION TECHNOLOGY P1
2021
MARKS: 150
TIME: 3 hours
1. This question paper is divided into FOUR sections. Candidates must answer
ALL the questions in each of the FOUR 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 specific to the
Delphi programming language.
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 Delphi for any of these
routines.
8. All data structures must be declared 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.
Do the following:
Once extracted, the following list of files will be available in the folder
DataENGJune2021:
FILES PROVIDED:
Question 1:
Question1_P.dpr
Question1_P.dproj
Question1_P.res
Question1_U.dfm
Question1_U.pas
Question 2:
ConnectDB_U.pas
Question2_P.dpr
Question2_P.dproj
Question2_P.res
Question2_U.dfm
Question2_U.pas
ShoppingMallDB - Copy.mdb
ShoppingMallDB.mdb
Question 3:
GiftVoucher_U.pas
Question3_P.dpr
Question3_P.dproj
Question3_P.res
Question3_U.dfm
Question3_U.pas
Question 4:
Barbedos.txt
Kensley.txt
Maistry.txt
Question4_P.dpr
Question4_P.dproj
Question4_P.res
Question4_U.dfm
Question4_U.pas
Copyright reserved Please turn over
Information Technology/P1 4 DBE/2021
SC/NSC
SECTION A
Do the following:
The length of a loaf of bread is 242 mm. The user is required to select/enter
the number of the slices of bread required using the spin edit component. The
program must calculate the thickness of the slices.
Declare appropriate variables of the correct data type for the number of
slices and the thickness of the slices. See example output.
A picture has already been loaded in the imgQ1_1 image component.
Ensure that the full image of the picture is displayed.
Retrieve the number of slices of bread selected from the spnQ1_1 spin
edit.
Calculate the thickness of the slices in millimetres (mm).
Display the thickness of the slices formatted to TWO decimal places in
the lblQ1_1 label.
(7)
The cost of a loaf of bread is R12.90. The change needs to be calculated for
an amount that is offered to buy a loaf of bread.
(11)
Example of output:
NOTE: The values in the example output may differ from your output as the
values are randomly generated.
(10)
1.4 Button [1.4 - Hidden security code]
The character before every letter 't' (lower case) in sParagraph must be
extracted and combined to form a security code.
If the character before a letter 't' is a space, it must be ignored and must
NOT form part of the security code.
The search for characters for the security code must start at the beginning
of the paragraph.
The maximum length of the security code is 8 characters.
The security code must be displayed in upper case in the edit box
edtQ1_4.
Write code to compile the security code using a loop structure and by
applying the specified rules.
NOTE: Your code must output the correct security code for any text
assigned to the sParagraph variable.
sParagraph = 'I am not lazy, I am just very relaxed. He who laughs last did not get the
joke. When nothing is going right, go left. I love school when it is vacation. I put the
"Pro" in procrastinate.'
(12)
Ensure that your examination number has been entered as a comment in the first
line of the program file.
Save your program.
Print the code if required.
TOTAL SECTION A: 40
SECTION B
The data pages attached at the end of the question paper provide information on the
design of the database and the content of the tables.
Do the following:
Follow the instructions below to complete the code for each section, as described
in QUESTION 2.1 and QUESTION 2.2.
NOTE:
The 'Restore database' button is provided to restore the data contained in the
database to the original content.
Code is provided to link the GUI components to the database. Do NOT change
any of the code provided.
TWO variables are declared as public variables, as described in the table on the
next page.
NOTE:
Display ALL fields of the shops in the tblShops table, sorted from the
largest to the smallest shop according to the ShopSize field.
(3)
The user must select a manager number from the combo box
cmbQ2_1_2. Code has been provided to assign the manager number
selected by the user to a variable sManagerNum. Display the
ShopName of all the shops managed by the manager associated with
the selected manager number.
(3)
The rental cost of space in the mall is R65.00 per square metre. Use
the ShopSize field, which is in square metres, to calculate the rental
costs for each shop. Use the new field named Rental to keep the rent
amounts.
Display the shop name, shop size and calculated rental amount of all
shops with rental amounts that exceed the value of R50 000. The
rental amount must be formatted as currency.
Example of output:
(5)
Example of output:
(6)
The clothing shop, Jeans 4U, has moved to another shopping mall.
A new clothing store with the name TeenDream opened in its place.
Modify the relevant record by changing the shop name Jeans 4U to
TeenDream.
Example of output:
(3)
NOTE:
A shop is classified as a small shop if the size of the shop is less than
300 square metres.
Write code to count and display the number of small shops in the rich
edit component redQ2_2_1.
Example of output:
(7)
Search the relevant table to find the name of the shop that was
entered.
If the name of the shop is found, display the name, surname and
contact number of the manager of the shop in the rich edit
component redQ2_2_2.
If the name of the shop is NOT found, use a message dialogue
box to display the message 'The shop is not in this mall.'
Example of output if the name of the shop that was entered was not
found:
(13)
Ensure that your examination number has been entered as a comment in the first
line of the program file.
Save your program.
Print the code if required.
TOTAL SECTION B: 40
Copyright reserved Please turn over
Information Technology/P1 14 DBE/2021
SC/NSC
SECTION C
The MidCity Shopping Centre sells gift vouchers that can be used at any shop in the
shopping centre. The minimum amount available per gift voucher card is R50 and the
maximum amount available is R300.
Do the following:
Open the incomplete program in the Question 3 folder.
Open the incomplete object class GiftVoucher_U.pas.
Enter your examination number as a comment in the first line of both the
Question3_U.pas file and the GiftVoucher_U.pas object class file.
Compile and execute the program. The program has limited functionality currently.
NOTE: For this question, you are NOT allowed to include any additional attributes or
user-defined methods not stated in the question.
3.1 The provided incomplete object class (TGiftVoucher) contains code for the
declaration of three attributes that describe a GiftVoucher object.
3.1.1 Write code for a constructor method that will receive the gift voucher
number, the name of the customer and the balance (amount available
on gift voucher) as parameter values. Assign these values to the
respective attributes. (4)
3.1.2 Write code for two accessor methods called getVoucherNumber and
getBalance for the fVoucherNumber and fBalance attributes
respectively. (4)
3.1.3 Write code for a method called isSufficient to receive a real value for
a purchase amount and return a Boolean value TRUE if the balance
on the gift voucher is sufficient to pay the purchase amount, or
FALSE if not. (5)
3.1.4 Write code for a method called updateBalance that will receive a
purchase amount as a parameter and subtract the purchase amount
from the balance. (3)
3.1.5 Write code to complete the toString method to return a string in the
following format:
Example:
3.2 An incomplete program has been supplied in the Question 3 folder. The
program contains code for the object class to be accessible and declares an
object variable called objGiftVoucher.
Button [Purchase]
Extract the gift voucher number, the name of the customer and the
amount from the relevant components.
Use the extracted values to instantiate a new objGiftVoucher
object.
Display the details of the gift voucher in the output area redQ3_2_1
using the toString method.
Example of input and output if a gift voucher with the value of R250
was selected for Joe Smith:
(6)
(5)
(9)
Ensure that your examination number has been entered as a comment in the first
line of the object class and the form class.
Save your program.
Print the code in the object class and the form class if required.
TOTAL SECTION C: 40
SECTION D
Three new malls have been built recently. Each mall has a ground floor that has demo
shops to showcase the types of shops on the different levels at the mall. For example,
if the ground floor has a clothing store, a restaurant and a furniture store, then the other
levels in the mall can only have the types of shops as showcased on the ground floor.
Do the following:
Three text files, one for each of the three different malls (Kensley, Barbedos,
Maistry). Each line of text in a text file represents a level in the mall. The characters
that a line of text consists of indicate the types of shops on a specific level in the
mall. For example, the text file named 'Kensley' contains six lines of text which
means there are six levels:
LEJCF
JCFERECFLE
EJCFFECCFFEERRR
JECFFRRJECFFRRE
LEJCFLLLL
FFLEJJJJCCCF
Each character in a line of text represents a type of shop (the first letter of the given list
of shop types in array arrShopTypes) that can be found on that specific level in the
mall. For example, the letter E refers to Electronics, J refers to Jewellery and so on.
The characters used are E, J, F, C, R, T, L and G.
The second line of text in the text file for the Kensley Mall contains the following line of
text, 'JCFERECFLE', which indicates that there are 10 shops on level 2 of the mall –
one jewellery shop (J), two clothing shops (C), two furniture shops (F), three
electronics shops (E), one restaurant (R) and one laundry (L).
Write code to perform the tasks described in QUESTION 4.1 to QUESTION 4.2.
The user must select a mall from the radio group rgpQ4.
Use the text of the radio button selected to compile the file name which
indicates which text file to read.
Read the contents of the text file into an array. The maximum number of
levels in a mall is ten.
Display the lines of text representing the type of shops in the mall per level
and the number of shops per level, as shown in the screenshot below.
The display of the shops must be right-justified. You can assume that the
maximum length of a line of text with the types of shops, including the
spaces, is 25.
(15)
An enquiry about the number of shops of a specific type per level in the mall
must be processed and displayed. The user must enter a character
representing the type of shop using an input box.
Show an error message if the input character is not in the range of valid
characters, namely E, J, F, C, R, T, L and G.
If a valid character is entered, the number of the specified type of shop in the
selected mall must be determined per level and neatly displayed, as shown in
the examples below. The heading of the output must display the description of
the type of shop in the arrShopTypes array.
Example of output if the Kensley Mall was selected and F was selected as the
shop type:
Example of output if the Barbedos Mall was entered and C was selected as
the shop type:
(15)
Ensure that your examination number has been entered as a comment in the first
line of the program file.
Save your program.
Print the code if required.
TOTAL SECTION D: 30
GRAND TOTAL: 150
Copyright reserved
Information Technology/P1 1 DBE/2021
SC/NSC
INFORMATION TECHNOLOGY P1
Table: tblManagers
The table contains the records of the managers who manage each court in the
shopping mall.
Table: tblShops
The table contains the information of the shops located in the shopping mall.
Copyright reserved
Information Technology/P1 2 DBE/2021
SC/NSC
NOTE:
Connection code has been provided.
The database is password-protected, therefore you will not be able to access the
database directly.
The following one-to-many relationship with referential integrity exists between the
two tables in the database:
Copyright reserved