INFORMATION TECHNOLOGY
PAPER 1
GRADE 12
AMENDED SENIOR CERTIFICATE EXAMS
PAST PAPERS AND MEMOS
MAY/JUNE 2018
INSTRUCTIONS AND INFORMATION
NOTE:
Candidates must use the file DataENGJune2018.exe.
Do the following:
Once extracted, the following list of files will be available in the folder DataENGJune2018:
SUPPLIED FILES
Question1:
Question2:
Question3:
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
Do the following:
The following user interface is displayed:
1.1 OnCreate Event [Question 1.1]
Write code in the 'OnCreate' event handler of the Form to change the text displayed on the pnlQ1_1 panel as follows when the program is executed:
Example of output:
NOTE: The format of the system date may differ from the example. (6)
1.2 Button [1.2 - Display]
Write code using the loop counter variable cCounter and a loop to compile a string containing the letters 'Z' to 'R' in the variable sOutput. Assign the variable to the edit box to display.
Example of output:
(6)
1.3 The time it takes a student to read a textbook depends on the total number of words the textbook contains and whether the content is of a technical nature or not.
1.3.1 Button [1.3.1 - Total number of words]
The average number of words per page in a textbook of standard size has been declared as 300 in a constant variable called WordsPerPage.
The user needs to select the number of pages the book contains from the spin edit component.
Complete the provided code to do the following:
NOTE: The variable iTotalNumWords has been declared as a global variable to be used again in QUESTION 1.3.2.
Example of output:
(5)
1.3.2 Radio group [1.3.2 – Type of book]
Research shows that a student can read a literature book at the speed of 250 words per minute and a technical book at the speed of 75 words per minute. These values have been declared as constant values using the variables WordsLit and WordsTech respectively. The user needs to select the type of book from the radio buttons provided.
Write code to do the following to determine the time it should take a student to read the book:
NOTE: If you were not able to calculate the total number of pages in QUESTION 1.3.1, assign a value of 33 600 to the global variable iTotalNumWords to be able to do
QUESTION 1.3.2.
Example of output if the book is a technical book and has 112 pages, which results in 33 600 words, as calculated in QUESTION 1.3.1:
Example of output if the book is a literature book and has 112 pages, which results in 33 600 words, as calculated in QUESTION 1.3.1:
(7)
1.4 Combo box [cmbQ1_4]
The user needs to select a password from the combo box cmbQ1_4 which contains a number of encrypted passwords.
Write code to decrypt the selected password according to the instructions below.
Example of output if the password os3%!ko has been selected:
Example of output if the password ay7#@tod has been selected:
(13)
1.5 Button [1.5 - Coordinates]
The formula for a straight line is y = mx + c. The formula must be used to calculate the value of the y-coordinate of the straight line if the value of x is entered by the user.
The values of 3 and -2 will be used as the values for m and c in the formula and has been assigned to the variables iM and iC respectively in the code provided.
Write code to display the (x,y) coordinates of a straight line in the output area using the following instructions:
Example of the calculation of y if the value 7 is entered for x:
y = mx + c
= 3(7) +(-2)
= 19
Example of output if the value of 7 was entered for the value of x:
Example of output if the value of 12 was entered for the value of x:
(13)
|
TOTAL SECTION A: 50
SECTION B
QUESTION 2: OBJECT-ORIENTATED PROGRAMMING
Students are allowed to borrow and return books in the research wing of the library during the week that they are working on their research projects. Data has been captured in a text file on the books that were borrowed and returned during a research week. The librarian needs to use the captured data to see how many copies of the books are available currently to allow books to be borrowed and returned during the next research week. |
Do the following:
2.1 Complete the code in the TBook object class provided, as described in QUESTION 2.1.1 to QUESTION 2.1.7 that follow.
2.1.1 Declare the attributes of the class using the information in the table below. (4)
NAMES OF ATTRIBUTES | DESCRIPTION |
fTitle | The title of the book |
fCatNum | A unique catalogue number assigned to each book in the library, e.g. D324.2 |
fNumBooks | An integer number that indicates the number of copies of this book that the library owns, e.g. 12 |
fNumBooksOut | An integer number that indicates the number of copies of this book that is currently borrowed, e.g. 5 |
2.1.2 Write code to create a constructor which receives THREE parameter values (the title, the catalogue number of the book and the number of copies of the book that the library owns) and initialises the relevant attributes using the parameter values. The attribute for the number of copies of the book out (currently borrowed) must be initialised to zero. (5)
2.1.3 Write an accessor method getCatalogueNumber for the catalogue number attribute of the book. (2)
2.1.4 Write an accessor method getNumBooksOut for the number of books out attribute. (2)
2.1.5 Write code for a mutator method setNumBooksOut to receive an integer as a parameter and set the fNumBooksOut attribute to the parameter value. (3)
2.1.6 Write code for a method called isBookAvailable that returns a Boolean value. This method must use the fNumBooks and fNumBooksOut attributes to determine whether a copy of the book is currently available in the library or not. The return value must be true if a book is available or false if not available. (3)
2.1.7 Write code to create a toString method to return a string formatted as follows:
The library owns < number of copies owned> copies of the book titled <book title> [<catalogue number>].
The number of copies currently out is <number of copies of the book currently borrowed>. (5)
Do the following to complete the code for Buttons 2.2.1, 2.2.2 and 2.2.3 in the main form unit, as described below.
2.2.1 Button [2.2.1 - Instantiate book object]
The user needs to select the catalogue number of the book from the combo box. Code has been provided to show the title and the number of copies of the selected book that the university owns in the relevant edit boxes.
Write code to do the following:
Example of output for the book if catalogue number G292.6 has been selected and the object has been instantiated:
2.2.2 Button [2.2.2 - Update data]
A text file BooksData.txt contains the records of books that were borrowed and returned during a research week.
The data in the text file is saved in the following format:
<catalogue number of book>#<a character indicating whether the book was borrowed (B) or returned (R)>
Example of the first six lines of data in the BooksData.txt text file:
The text file must be used to determine the number of copies of the selected book that were borrowed and returned during the research week. (8)
Write code to do the following:
Example of output for the Update data button if catalogue number G292.6 has been selected by the user and an object of this book has been instantiated:
(20)
2.2.3 Button [2.2.3 - Process request]
Special requests to borrow books from the research wing can be granted if copies of the book are available. Students who did not return books that they borrowed during the research week are also allowed to return the books.
The radio group component must be used to select to either borrow or return the selected book. If the request to borrow or return the selected book has been granted, the text file BooksData and the object details of the book must be updated.
Write code for the following algorithm to process the borrow or return request for the selected book:
Set the provided sCode variable to an empty string Display a suitable message else Display a message to indicate there are no copies available If Return has been selected from the radio group If number of books out is 0 else Display a message indicating that the book has been returned If sCode contains data Write the catalogue number of the book and the value of sCode to the BooksData.txt text file in the correct format, e.g. G292.6#R |
NOTE: A Restore text file button has been provided that can be used to restore the content of the BooksData text file if the content of the BooksData text file becomes corrupted while testing your code. This will copy the data in the BooksDataBackup text file to the BooksData text file.
Example of output if a student requested to borrow the book titled Basic Mathematics if copies of this book are available to be borrowed:
The following updated data should be displayed in the output area:
Example of output if a student requested to borrow the book titled Basic Mathematics if no copy of this book is available to be borrowed:
Example of output if a student requested to return the book titled Basic Mathematics:
The following updated data should be displayed in the output area:
Example of output if there is a request to return the book titled Coding in Objects with catalogue number C284.3. All the copies of this book have been returned. Therefore the request is invalid.
(18)
TOTAL SECTION B: 70
SECTION C
QUESTION 3: PROBLEM-SOLVING PROGRAMMING
SCENARIO The university has three libraries. The first two libraries are open for six days of the week and the third library is open for five days of the week. There are six staff members who will be on duty in the libraries on the days the libraries are open. The manager of the library requires a program to create and maintain a placement schedule for staff members. |
Do the following:
Supplied GUI:
The GUI below represents an interface used by the manager of the library to allocate duties shifts to staff members.
The following code has been provided:
Example of the output of a schedule that will be displayed when the display procedure is called to display the content of arrPlacements. Library 3 can be closed on any day, as decided by the manager. For this schedule, the manager has decided to close Library 3 on Day 2, which is represented by 'XXXXX' in array arrPlacements.
The row and column headings are not part of the content of the two-dimensional array provided.
NOTE:
3.1 Combo box [3.1 - Select name]
A staff member may request a schedule of his/her duties.
When a name is selected from the combo box cmbStaff, the following information must be displayed in the output component provided:
The format of the work schedule details is as follows:
Day <day number>-Library#<library number>
Example of output if staff member Tamzin was selected from cmbStaff:
Example of output if staff member Nkosi was selected from cmbStaff:
(10)
3.2 Button [3.2 - Create new schedule]
A one-dimensional array called arrStaff is provided and must be used to create a new schedule for staff members. The new schedule must be saved in the two-dimensional array arrPlacements.
Write code to compile a new placement schedule for staff members by populating the arrPlacements array with the names of staff members as follows:
Library 1: Each staff member will be placed on duty according to the order of the appearance of their names in the array arrStaff. The first staff member in the array will be assigned to Day 1, the second staff member to Day 2 and so on.
Library 2: Each staff member will be placed on duty in the reverse order of the contents of the array arrStaff. The first staff member in the array will be assigned to Day 6, the second staff member to Day 5 and so on:
Library 3: Write code to use an input box to prompt the manager to enter a day number (1 to 6) on which Library 3 will be closed. Array arrPlacements must show 'XXXXX' for the day the library is closed. The staff will be allocated randomly for the remainder of the days to this library. A test must be done to ensure that the staff member randomly selected for Library 3 is not already allocated to Library 1 or Library 2 for that day.
Example of output if the manager entered Day 3 for Library 3 to be closed:
(20)
|
TOTAL SECTION C: 30
GRAND TOTAL: 150