Information Technology
Paper One (P1)
Grade 12
Amended Senior Certificate Exam
Past Papers And Memos 2016
INSTRUCTIONS AND INFORMATION
DELPHI FILES | JAVA (NETBEANS) FILES |
Question1: Question1_P.dpr Question1_P.res Question1_U.dfm Question1_U.pas | Question1: Question1.form Question1.java |
Question2: PrescriptionItem.pas Question2_P.dpr Question2_P.res Question2_U.dfm Question2_U.pas | Question2: PrescriptionItem.java Question2.form Question2.java |
Question3: Question3_P.dpr Question3_P.res Question3_U.dfm Question3_U.pas DataQ3.txt | Question3: |
SCENARIO |
SECTION A
QUESTION 1: GENERAL PROGRAMMING SKILLS
The medical centre has a number of different facilities that are available to the community. |
Do the following:
1.1 Write code to set the font size of the text on the label lblQuestion1_1 to 14 pt and display the text 'Good Health Medical Centre' on the label when the program is executed.
(2)
1.2 Button [Question1_2]
The community is encouraged to contribute towards a medical aid scheme. The scheme offers four options: Option A to Option D. Option A provides the minimum number of benefits and is the least expensive option with an amount of R1 000,00 per month as contribution for the main member of a family. This amount increases by 20% with each option (Option B, Option C and Option D) thereafter.
Family members of the main member are added as dependants to the account of the main member. An amount of 50% of the payment by the main member will be added to his/her account for each dependant.
The user must select an option from the list box and enter the number of dependants in the text box.
Write code to calculate the total monthly payment the member has to make towards the medical aid scheme. Display the monthly payment in a dialog box with a suitable message. If no option was selected, display a message instructing the user to select an option.
Example of output if Option A is selected and the number of dependants is one:
Example of output if Option B is selected and the number of dependants is three (as below):
(10)
1.3 Button [Question1_3]
The patient's account can be paid over a period of 12 months.
The first payment is calculated as 15% of the account balance. After the first payment has been deducted the balance must be paid in equal payments over the remainder of the months.
The user is required to enter the account balance in the text box.
Write code to calculate and display the payment number, the amount to be paid monthly and the decreasing balance in neat columns with suitable headings. The amounts must be formatted to currency with two decimal places.
(10)
1.4 There are three doctors on duty every day:
Doctor 1, Doctor 2 and Doctor 3. The total number of patients must be divided equally amongst the three doctors. If there are any remaining patients, the first patient will be allocated to the first doctor (Doctor 1) and the second patient to the second doctor (Doctor 2).
The algorithm below was compiled to calculate and display the number of patients each doctor will attend to during the day.
Algorithm:
1.4.1
(3)
1.4.2
The doctors on duty have to wait until all the patients on the list have been attended to before they can sign out as a team. They have to provide the number of hours and minutes they have worked using the number of hours and minutes that the first doctor has worked. They are only allowed to sign out on the hour. For example, if they worked for 3 hours and 30 minutes, starting at 08:00, they will all sign out at 12:00.
Add code to the QUESTION1_4 button to do the following:
Obtain the duration of one consultation in minutes. The default time is 15 minutes, but the user is allowed to enter any other value. Obtain the time of day when consulting starts. Calculate and display the time the doctors have worked and the time of day when they will sign out.
Example of output if the total number of patients is five, the duration of one consultation is 15 minutes and consulting starts at 08:00:
Example of output if the total number of patients is ten, the duration of one consultation is 20 minutes and consulting starts at 13:00:
(10)
|
TOTAL SECTION A: 45
SECTION B
QUESTION 2: OBJECT-ORIENTATED PROGRAMMING
The Good Health Pharmacy allows pharmacists to enter the prescription the patient has received for tablets electronically. The labels for the tablet containers and a patient account will then have to be created. The total cost of all prescriptions required must then be calculated. |
Do the following:
DELPHI PROGRAMMERS | JAVA PROGRAMMERS |
|
|
2.1
The given incomplete object class (TPrescriptionItem/PrescriptionItem) contains the declaration of four attributes that describes the PrescriptionItem object.
The given attributes of the PrescriptionItem object are as follows:
NAMES OF ATTRIBUTES | DESCRIPTION | |
Delphi | Java | |
fCode | code | A unique six-character code allocated to each prescribed tablet |
fDosage | dosage | A string consisting of four characters to indicate the number of tablets to take (See explanation in note below.) |
fDays | days | The prescribed number of days the tablets must be taken |
fPrice | price | The price of a single tablet |
Complete the code in the given PrescriptionItem class (TPrescriptionItem/PrescriptionItem) as described in QUESTIONS 2.1.1 to 2.1.6 below.
NOTE: The dosage attribute consists of four characters in the format XX#X, where the # is used as a symbol to separate information.
Example 1: D1#B
Example 2: H2#8
First character | Explanation |
D | Tablets must be taken once daily. Second character: Number of tablets to take at a time Fourth character: B: After breakfast S: After supper Example: D1#B means: Take one tablet daily after breakfast. |
H | Tablets must be taken hourly. Second character: Number of tablets to take at a time Fourth character: Refers to the hourly period that the tablet must be taken. The hourly period can either be 2, 3, 4, 6 or 8. Example: H2#8 means: Take two tablets every 8 hours. |
2.1.1 Write code for a constructor method to receive the tablet code, dosage code, number of days and the price per tablet as parameter values. Assign these values to the relevant attributes. (4)
2.1.2 Write a method called calcTabletsPerDay that will use the dosage code to determine and return the number of tablets that is prescribed per day. A day is regarded as a period of 24 hours.
Example 1: If the dosage code is D1#S, it means that one tablet must be taken daily after supper.
Example 2: If the dosage code is H2#4, it means that two tablets must be taken every four hours, which adds up to a total of 12 tablets per day. (8)
2.1.3 Write a method called compileFrequencyOfUseMessage that will use the dosage code to compile and return a message indicating when the tablets should be taken.
Example 1: If the dosage code is D1#S, the message to return is: Take 1 tablet(s) daily after supper.
Example 2: If the dosage code is H4#8, the message to return is: Take 4 tablet(s) every 8 hours. (8)
2.1.4 Write a method called calcTotalTablets to calculate and return the total number of tablets for this prescription item. (3)
2.1.5 Write accessor methods for the tablet code and price attributes. (2)
2.1.6 Write a compileLabel method to return the necessary information to be printed on the label of the tablet container in the format shown below.
Tablet code: <code>
<Frequency of use message> for <number of days> days
(<Total number of tablets included> tablets)
Example of output if the tablet code is HPCMCN, the dosage code is H2#8 and the number of days is four:
Tablet code: HPCMCN Take 2 tablet(s) every 8 hours for 4 days. (24 tablets) |
(5)
2.2 Two parallel arrays are provided in the incomplete class Question2_U.pas/Question2.java.
The array called arrCodes contains the codes of all available tablets. The array called arrPrices contains the prices per single tablet for each corresponding code.
Example of data in the supplied arrays:
The first four codes in the arrCodes array:
CBLTAD, HPCMCN, TRVKMG, BGJKPT
The first four prices in the arrPrices array:
17.89, 14.60, 23.50, 22.75
The data for the first tablet can be interpreted as follows:
Do the following to complete the code for each button in the main form unit (Delphi)/GUI class (Java):
NOTE: The object objPrescriptionItem has been declared in the program.
2.2.1 Code for the combo box
The user is required to select the code of the tablet from the relevant combo box. If the code selected ends with the letter 'G', it means that a generic equivalent for the tablet is available. The panel pnlGeneric must be displayed, which allows the user to choose the generic equivalent of the tablet.
A generic tablet is defined as a tablet that is used to treat the same condition as the original tablet but is usually sold at a lower price.
In this program the cost of the generic equivalent of a tablet is 40% less than the cost of the original tablet. The arrPrices array contains the prices of the original tablets.
The pnlGeneric panel must not be visible if there is no generic equivalent available for the tablet.
HINT: The indices of the codes in the arrCodes array are the same as those of the codes in the combo box. (9)
2.2.2 Button [2.2.2 – Instantiate Prescription Item]
Use the information supplied by the user and instantiate a new PrescriptionItem object. The tablet code, dosage code, number of days and the price per tablet must be used as arguments to instantiate the object.
If the pnlGeneric panel appears and the generic check box is selected, the price of the tablet must be reduced by 40% before the object is instantiated.
Display a message in a dialog box to indicate that the object was instantiated successfully.
(8)
2.2.3 Button [2.2.3 – Display]
Use the compileLabel method to display the label information in the output area on the Prescription Item panel.
Also display the tablet code and the cost of this prescription item in the output area of the Prescription Account panel. The cost must be formatted to currency with two decimal places.
NOTE: The total cost of all prescription items must be calculated to be displayed when the 2.2.4 – Total of all Prescription Items button is clicked.
Example of output for the prescription item and account details if the tablet code is HPCMCN, the dosage code is D2#B and the number of days entered is 3:
(8)
2.2.4 Button [2.2.4 – Total of all Prescription Items]
Display the total amount owed for this specific prescription, formatted to currency with two decimal places.
Example of output for the Prescription Account output area after all prescription items have been entered:
(2)
2.2.5 Button [2.2.5 – Clear All]
Clear the output area for the prescription item and the prescription account. Also clear all the input components and set the relevant variables to 0. (3)
|
TOTAL SECTION B: 60
SECTION C
QUESTION 3: PROBLEM-SOLVING PROGRAMMING
SCENARIO |
Do the following:
Ward 1 | Ward 2 | Ward 3 | Ward 4 | Ward 5 | |
Emergency | 10 | 9 | 10 | 8 | 9 |
Children | 9 | 10 | 10 | 9 | 10 |
Adults | 9 | 3 | 8 | 2 | 1 |
3.1 Button [3.1 – Display Ward Statistics]
The program must display the different sections, ward numbers and the number of patients in each ward. The information must be neatly displayed in columns with suitable headings and labels.
Example of output:
(8)
3.2 Button [3.2 – Place New Patients]
A text file called DataQ3.txt contains information on new patients that need to be admitted. Each line of text in the file contains the full name and date of birth (YYYY-MM-DD) of the patient separated by a hash character. If the patient must be admitted to the emergency ward, a semicolon, followed by the character 'E', has been added to the line of text.
Example of the first three lines of text in the file:
Debra Jenkins#2005-10-12
Geraldine Mathews#1992-01-09
Nosipho Mbele#2010-09-23;E
Write code to do the following:
Check whether the text file DataQ3.txt exists.
If the text file does not exist, display a suitable message and close the program. If the text file exists, do the following for each new patient:
Example of Ward Statistics output area after new patient details have been processed:
MARK ALLOCATION FOR QUESTION 3.2 | |
Read and obtain information from the text file. | 10 |
Determine the section to which the patient will be admitted. | 8 |
Determine the ward that is available in the specific section. | 7 |
Construct the placement code or the words 'Waiting list'. | 6 |
Update the arrWardStats array. | 2 |
Display the name, age and placement code or words of the new patient. | 3 |
Display the updated arrWardStats array. | 1 |
TOTAL | 37 |
|
TOTAL SECTION C: 45
GRAND TOTAL: 150