INFORMATION TECHNOLOGY
PAPER 1
GRADE 12
NSC PAST PAPERS AND MEMOS
FEBRUARY/MARCH 2017
INSTRUCTIONS AND INFORMATION
Do the following:
Once extracted, the following list of files will be available in the folder DelphiDataENGMarch2017/JavaDataENGMarch2017:
DELPHI FILES | JAVA (NETBEANS) FILES |
Question1: | Question1: |
Question1_P.dpr | Question1.form |
Question1_P.dproj | Question1.java |
Question1_P.res | Type1.PNG |
Question1_U.dfm | Type2.PNG |
Question1_U.pas | |
Type1.PNG | |
Type2.PNG | |
Question2: | Question2: |
CardHolder_U.pas | CardHolder.java |
DataJanuary2017.txt | DataJanuary2017.txt |
Question2_P.dpr | Question2.form |
Question2_P.dproj | Question2.java |
Question2_P.res | |
Question2_U.dfm | |
Question2_U.pas | |
Question3: | Question3: |
Question3_P.dpr | Question3.form |
Question3_P.dproj | Question3.java |
Question3_P.res | |
Question3_U.dfm | |
Question3_U.pas |
SCENARIO Loyalty cards are often used to create profiles for customers. It is also a popular way of motivating customers to visit shops that regularly award loyalty points for purchases made. |
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
An applicant must complete an application form to obtain a loyalty card. |
Do the following:
Example of graphical user interface (GUI):
1.1 Button [Question 1_1]
A label called lblWelcomeMessage has been created and set to be not visible. Write code to validate the information entered by the user as follows:
If the contents in both fields are valid, the label displaying the welcoming message must be set to visible.
Example of message if no space was entered in the name-surname field:
Example of message if the ID number field was left blank:
Example of message if the ID number that was entered does not consist of 13 digits:
(14)
1.2 Buttons with images [Question 1_2]
A customer must select the preferred type of loyalty card. The images on the buttons in this section of the GUI show two types of loyalty cards. When a specific image is selected (button clicked), the program must do the following:
NOTE: Only the label for the currently selected button must appear in bold. If the user selects the other type of loyalty card, the label of the previously selected loyalty card must NOT appear in bold. (6)
1.3 Button [Question 1_3]
The final purchase amount for today must be entered in the text box.
The program must grant the following benefit towards the holder of the type of loyalty card selected in QUESTION 1_2:
Display a message describing the benefit granted depending on the type of loyalty card.
Example of output if the code of the loyalty card is DI and the purchase amount R1 200:
NOTE: The discount amount must be displayed as a currency with two decimal digits.
Example of output if the code of the loyalty card is CH and the purchase amount R230:
(15)
1.4 Button [Question 1_4]
The customer's ID number entered in QUESTION 1_1 and the type of loyalty card selected in QUESTION 1_2 are required to compile the customer's loyalty card number. A loyalty card number consists of three parts. Each part of the number must be compiled as follows and displayed in the components provided:
Part 1:
The first part of the loyalty card number consists of either the letter B if the business card check box was selected or the letter P if the business card check box was not selected, followed by the first three digits of the customer's ID number.
Part 2:
A string called charString, which contains the following 10 characters, has been supplied as part of the code provided:
! @ # $ % ] & * ^ ~
Each character contained in the string represents a digit (0–9). This means that the first character (!) represents the digit 0, the second character (@) the digit 1, and so on.
This part of the loyalty card number must consist of the last digit from the customer's ID number, followed by the character from charString that represents that digit.
Example of this part of the loyalty card number if the customer's ID number is 8802128756084:
4%
Part 3:
This part of the loyalty card number consists of the code representing the type of loyalty card (DI or CH) established in QUESTION 1_2.
Example of the loyalty card number of a customer with the following profile:
(13)
|
TOTAL SECTION A: 48
SECTION B
QUESTION 2: OBJECT-ORIENTATED PROGRAMMING
The local supermarket has a loyalty card system where customers can receive rewards depending on the number of visits, the number of loyalty points gathered and the percentage of health food bought.
Do the following:
Delphi programmers | Java programmers |
|
|
2.1 The given incomplete object class (TCardHolder/CardHolder) contains the declaration of five attributes, the toString() method and an incomplete isCorrect() method.
The given attributes of the CardHolder object:
NAMES OF ATTRIBUTES | DESCRIPTION | |
Delphi | Java | |
fCardNumber | cardNumber | A unique number for the card holder |
fCellNumber | cellNumber | The cellphone number of the card holder |
fNumVisits | numVisits | The number of times the card holder visited the shop during the month |
fLoyaltyPoints | loyaltyPoints | The total number of loyalty points received on this card up to now |
fHealthLevel | healthLevel | A character indicating the health level of the card holder, based on the amount of health food bought during the month: S – Silver (Lowest level) |
Complete the code in the given CardHolder class (TCardHolder/CardHolder) as described in QUESTION 2.1.1 to QUESTION 2.1.6 below.
2.1.1 Write code for a constructor method to receive the card number, cellphone number and loyalty card points already received, as parameter values. Assign these values to the relevant attributes. The lowest code for the health food level (S) must be assigned to the attribute for the health level. The attribute for the number of visits must be set to 0. (5)
2.1.2 Write a mutator method to be able to set the attribute for the number of visits to a value received as a parameter. (2)
2.1.3 Write code for a method called increaseLoyaltyPoints that receives the total amount spent for this month as a parameter and increases the current number of loyalty points based on the amount received.
Use the following criteria:
2.1.4 Write code for a method called updateHealthLevel that will receive the total amount spent for this month and the amount spent on health food for this month as parameters. Calculate the percentage that was spent on health food and set the attribute for the health level according to the criteria provided in the table below.
Level code | Percentage indication |
S | Less than 10% |
G | 10% or more, but less than 40% |
P | 40% or more |
(7)
2.1.5 An access code is required to be able to update a customer's loyalty points. The customer's cellphone number has been used to compile the access code.
Write code to complete the isCorrect method provided. The method must test whether the access code received as a parameter is correct by applying the following instructions on the attribute for the cellphone number:
2.1.6 Write code for a method called identifyStarShopper that will return a string to indicate whether the card holder is a STAR shopper or not. A card holder is a STAR shopper if the following applies:
The string to be returned must either be 'STAR shopper' or an empty string. (6)
2.2 Information on the visits and purchases of card holders is saved for one month only in a text file. The text file called DataJanuary2017.txt contains the transactions made by four of the card holders during January.
The contents of text file is as follows:
Example of the first 12 lines of the text file DataJanuary2017.txt:
B921-3$-DI
1459.30
72.30
B870-4%-CH
899.80
22.50
P730-7*-DI
299.30
62.85
B870-4%-CH
869.30
182.55
Do the following to complete the code for each button in the main form unit (Delphi)/GUI class (Java), as in the section that follows.
NOTE: The object objCardHolder has been declared globally as part of the provided code.
2.2.1 Button – [2.2.1 – Check access code]
The user is required to select a card number from the four card numbers provided in the combo box.
Once a card number has been selected in the combo box, the cellphone number of the card holder and the number of loyalty points already earned from previous purchases are displayed with the provided code.
The user must enter the correct access code for the selected card number to allow the program to process the data of the card holder saved in the text file.
Write code to do the following:
If the correct access code has been entered, use the data in the DataJanuary2017.txt text file to determine the following regarding the purchases of the card holder:
Use this information and the relevant methods from the object class to update the number of loyalty points, the health level code and the number of times the card holder visited the shop for purchases.
Enable the button for QUESTION 2.2.2.
If the access code is NOT correct, display a message to indicate that the login was not successful and clear the access code text box.
The data in the table below can be used for testing purposes.
Card number | Access code |
B921-3$-DI | 188 |
B870-4%-CH | 41 |
P730-7*-DI | 338 |
B810-2#-DI | 170 |
(24)
2.2.2 Button – [2.2.2 – Display card holder details]
Write code to use the toString method to display the card holder object data in the output area provided.
The method created in QUESTION 2.1.6 must be used to indicate if the card holder is a STAR shopper.
Example of output for card number B921-3$-DI:
Example of output for card number B870-4%-CH:
(3)
|
TOTAL SECTION B: 65
SECTION C
QUESTION 3: PROBLEM-SOLVING PROGRAMMING
SCENARIO A social media companion app called Dine-Is-Fine has been designed specifically for the 10 restaurants at your local mall. You and your friends are registered users of this app. The app can be used to share your location with other registered users. |
Do the following:
Supplied GUI:
Supplied data:
You are provided with a two-dimensional array called arrMall filled with characters that represent the layout of the mall. The characters A to J represent 10 restaurants that you and your friends regularly visit.
Output area:
Decide on a suitable output component to be placed in the output area provided to display the content of the two-dimensional array.
NOTE:
3.1 Button [Display layout]
The program must display the layout of the mall. Write code to use the data supplied in the two-dimensional array to display the layout in neat columns.
Example of output:
(5)
Explanation of the data in the array:
NOTE: You will always remain in the same position for the purpose of this question.
3.2 Combo box with restaurant codes
You are requested to select a restaurant from the combo box where one of your friends will dine.
Write code to replace the X placeholder at the selected restaurant with a hashtag symbol (#) to indicate that a friend is at the restaurant and display an updated layout of the mall.
Example of output if two of your friends are dining at restaurant C and F respectively:
(13)
3.3 Button [Locate nearest friend(s)]
The program must determine at which restaurant(s) in the mall your friends currently are and how far they are from where you are. Every vertical or horizontal movement on the matrix represents a distance of 4,5 metres. From the restaurant(s) where your friends are, determine and display the restaurant(s) closest to where you are.
Example of output if your friends are dining at restaurants C and F:
Example of output if your friends are dining at restaurants C, F and H:
NOTE: You cannot move diagonally on the matrix.
MARK ALLOCATION FOR QUESTION 3.3
Locate the friends | 3 |
Determine the name of the restaurant | 4 |
Calculate the distance | 6 |
Find the nearest friend(s) | 3 |
Output to indicate position of friend(s) and distance | 2 |
Correct format of output for the nearest friend(s) | 1 |
TOTAL | 19 |
|
TOTAL SECTION C: 37
GRAND TOTAL: 150