Skip to content

Information Technology Grade 12 P1 NSC June 2012 QP (Afr)

Question paperInformation TechnologyGrade 12201233 pages

Grade 12 Information Technology Paper 1 question paper from the NSC June 2012 (Afrikaans), 33 pages. Read online or download the free PDF.

Free to read online, no sign-up needed

Answer online

Loading document…

Loading document…

Questions in this paper

Document textSearch extracted text and jump to a page.
Downloaded from hlayiso.com basic education Department: Basic Education REPUBLIC OF SOUTH AFRICA SENIOR CERTIFICATE EXAMINATION/ SENIORSERTIFIKAAT-EKSAMEN COMPUTER STUDIES P1/REKENAARSTUDIE V1 HIGHER GRADE/HOER GRAAD 2012 MARKS/PUNTE: 100 TIME/TYD: 3 hours/uur COMPUTER STUDIES/REKENAARSTUDIE HG : P1/V1 7241 72411 This question paper consists of 14 pages and 2 annexures./ Hierdie vraestel bestaan uit 14 bladsye en 2 bylaes. X@5 TMI Copyright reserved/Kopiereg voorbehou Please turn over/Blaai om asseblief
Rekenaarstudie/HG/V1 2 DBE/2012 Downloaded from hlayiso.com SSE INSTRUKSIES EN INLIGTING ile 10. 11. Hierdie is 'n drie-uur-eksamen. As gevolg van die aard van die eksamen is dit belangrik om kennis te neem dat jy NIE toegelaat sal word om die eksamenlokaal voor die einde van die eksamensessie te verlaat NIE. Hierdie vraestel bestaan uit TWEE afdelings: AFDELING A: Delphi (VRAAG 1 en 2) AFDELING B: Turbo Pascal (VRAAG 3 en 4) Beantwoord SLEGS die afdeling oor die programmeringstaal wat jy bestudeer het. Die eksamendisket wat jy sal ontvang, moet die volgende léers bevat: AFDELING A: DELPHI VRAAG 1: Vr1XXXX_u.pas; Vr1XXXX_p.dpr; D_werker.dat; D_tye.txt; D_lone.txt VRAAG 2: D_lesing.txt AFDELING B: TURBO PASCAL VRAAG 3: Vr3XX_p.pas; P_werker.dat; P_tye.txt; P_lone.txt VRAAG 4: P_lesing.txt Tik jou eksamennommer in as 'n kommentaarstelling in die eerste reél van elke program wat jy skryf. Maak rugsteunkopieé van die léers op die disket. Stoor jou werk elke tien minute. Volg die instruksies aan die einde van elke vraag met betrekking tot die dokumente wat jy moet druk en die léers wat jy op die eksamendisket moet stoor. Geen komponente van die Delphi-vorms mag verwyder, vervang of bygevoeg word nie. Gee aandag aan modulariteit, leesbaarheid, goeie programmeringstegnieke en gebruikersvriendelike toevoer en afvoer. Na drie uur sal addisionele tyd vir drukwerk voorsien word. Geen veranderinge mag in hierdie tyd aan enige dokumente gedoen word nie. Koplereg voorbehiou EVO A OMT baie
Computer Studies/HG/P1 2 DBE/2012 Downloaded from hlayiso.com SCE INSTRUCTIONS AND INFORMATION 1. 10. 7 This is a three-hour examination. Because of the nature of the examination it is important to note that you will NOT be allowed to leave the examination room before the end of the session. This question paper consists of TWO sections: SECTION A: Delphi (QUESTIONS 1 and 2) SECTION B: Turbo Pascal (QUESTIONS 3 and 4) Answer ONLY the section on the programming language that you have studied. The examination disk that you will receive must contain the following files: SECTION A: DELPHI QUESTION 1: Qu1XXXX_u.pas; Qu1XXXX_p.dpr; D_worker.dat; D_times.txt; D_payments.txt QUESTION 2: D_reading.txt SECTION B: TURBO PASCAL QUESTION 3: Qu3XX_u.pas; P_worker.dat; P_times.txt; P_payments.txt QUESTION 4: —P_reading.txt Type in your examination number as a comment statement in the first line of each program that you have written. Make backup copies of the files on the disk. Save your work every ten minutes. Follow the instructions at the end of each question with regard to the documents that you must print and the files that you must save on the examination disk. No components of the Delphi forms may be removed, replaced or added. Pay attention to modularity, readability, good programming techniques and user-friendly input and output. After three hours, additional time will be allocated for printing. No changes may be made to any documents during that time. Cont esoved NAN Peas tum oer
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 3 DBE/2012 SSE SCENARIO Die AmaGluGlu-vulstasie benodig 'n program om hulle te help met hulle algemene finansiéle administrasie. Hulle vra jou om hulle te help om sagteware te ontwikkel wat in die kantoor gebruik kan word. Data word opgeteken in dataléers en teksléers. LETWEL: Maak seker dat jy die inligting in BYLAE A en B baie sorgvuldig deurlees en verstaan, voordat jy die vraestel begin beantwoord. aici UIT IA A AA Bias! om assepiet
Downloaded from hlayiso.com Computer Studies/HG/P1 3 DBE/2012 SCE SCENARIO The AmaGluGlu petrol station is in need of a program to help them with their general financial administration. They ask you to help them to develop software that can be used in the office. Data is being inscribed onto data files and text files. NOTE: Make sure that you read the information ANNEXURES A and B to be sure that you thoroughly understand what is asked of you before you start answering the question paper. Coprintesoned A 0 A Pease tum over
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 4 DBE/2012 SSE AFDELING A: DELPHI VRAAG 1: DELPHI [80] Hierdie vraag is gebaseer op die dataléer D_werker.dat en die teksléer D_tye.txt. Beskou BYLAE A vir die struktuur van die inhoud van die léers. Jy word voorsien van 'n onvoltooide Delphi-program in die léergids Vraag 1. Maak die projekléer Vr1XXXX_p.dpr in Delphi oop en stoor die eenheid (‘unit') as Vr1XXXX_u.pas, asook die projekléer as Vr1XXXX_p.dpr ('XXXX' verteenwoordig jou eksamennommer). Wanneer die program uitvoer, sal die volgende koppelvlak op die skerm verskyn: | Vertoon Werker-inligting: i Loonsteaat < Herstel | Si Stuit | Verander slegs die opskrif (‘caption’) van die vorm sodat dit jou eksamennommer bevat en voeg jou eksamennommer by as 'n kommentaarstelling in die UNIT. Doen die volgende: 1.1 Definieer die volgende datatipe: 'n Rekord-datatipe, TWerker, gebaseer op die rekordstruktuur van die werker- dataléer. LET WEL: Elk van hierdie veranderlikes moet as 'n parameter na en van die subprogramme gestuur kan word. (5) 1.2 Kodeer 'n funksie-subprogram genaamd VanVL. Hierdie funksie ontvang die van en name van die werker as parameters. Dit stuur die werker se van, gevolg deur sy voorletters, terug. Nie al die werkers het dieselfde getal name nie. Voorbeeld: Mohamed Koos John — Mohamed, KJ Livingstone Solomon — Livingstone, S (8) opiered voorbenou COUT ON A A iia GAUTENG
Downloaded from hlayiso.com Computer Studies/HG/P1 4 DBE/2012 SCE SECTION A: DELPHI QUESTION 1: DELPHI [80] This question is based on the data file D_worker.dat and the text file D_times.txt. Examine ANNEXURE A for the structure of the content of the files. You are provided with an incomplete Delphi program in the folder Question 1. Open the project Qu1XXXX_p.dpr in Delphi and save the unit as Qu1XXXX_u.pas, as well as the project as Qu1XXXX_p.dpr ('XXXX' represents your examination number.) When the program is run, the following interface should appear on the screen: Display Worker Info: ‘ Payment Statement a Retry ; iL Close Change only the caption of the form to show your examination number and enter your examination number as a comment statement in the UNIT. Do the following: 1.1 Define the following data type: A record data type, TWorker, based on the record structure of the worker data file. NOTE: Each of these variables has to be able to be sent as parameters to subprograms. (5) 1.2 Code a function subprogram named Surlnit. This function receives the surname and names of the worker as parameters. It sends back the surname, followed by the initials of the worker. Not all the workers have the same number of names. Example: Mohamed Koos John — Mohamed, KJ Livingstone Solomon — Livingstone, S (8) iden FUT AMET A A Pease turn over
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 5 DBE/2012 SSE 1.3 Voltooi die kode vir die eerste opsie: [Vertoon Werker-inligting]. Wanneer die gebruiker dié opsie kies, moet die program: 1.3.1 Bepaal of die léer D_werker.dat bestaan. As die léer nie bestaan nie, moet 'n gepaste boodskap vertoon word. (2) 1.3.2 As die léer bestaan, moet die inhoud van die léer D_werker.dat op die skerm vertoon word, in netjiese kolomme, met opskrifte en subopskrifte soos in die voorbeeld hieronder getoon. Roep die funksie-subprogram VanVL om die werker se naam in die verlangde formaat te vertoon. [3 Vreagi: (fksamenommes) Vertaon Werker-inligting: Loonstaat | £3 Herstel | Si Stuit | Werker-inligting: AmaGluGlu-vulstasie: Rekord no: Naam: Geboortedatum: Kategorie: 1 Mohamed, KJ 1570971987 1 i 2 Livingstone, S 1271171976 2 (10) 1.4 Kodeer 'n funksie UreGewerk wat die getal ure wat 'n werker in 'n maand gewerk het, sal bereken. Die inteken- en uittekentye van elke werker per dag vir 'n spesifieke maand word in die teksléer D_tye.txt gestoor. 1.4.1 Stuur die werknemer se rekordnommer na die funksie as 'n waardeparameter. 1.4.2 Lees reél vir reél uit die teksléer D_tye.txt. 1.4.3 As die eerste getal in die reél ooreenstem met die rekordnommer van die werker, moet die ure gewerk vir daardie dag bereken word en by die totale ure gewerk vir daardie werker, getel word. 1.4.4 Getal ure per sessie gewerk, word soos volg bereken: Begintyd Eindtyd Ure gewerk (uur) (uur) 12 18 6 19 3 8 (19) Mopiereg voorpenou FTO UOT ACU A Piaa! om assepier GAUTENG
Downloaded from hlayiso.com Computer Studies/HG/P1 5 SCE DBE/2012 ve Complete the code for the first option: [Show Worker Info]. When a user chooses this option, the program should: 2) Determine if the file D_worker.dat exists. If the file does not exist, a suitable message should be shown. (2) 1.3.2 If the file exists, the content of the file D_worker.dat should be shown on the screen in neatly defined columns with headings and subheadings, as shown in the example below. Call the function subprogram Surlnit to show the worker's name in the asked format. Display Worker Info: Payment Statement | £3 Retry | i Close | \Warker Info: AmaGluGlu Petrol Station: Record No: Name: Date of Birth: Category: 1 Mohamed, KJ 16/09/1987 1 2 Livingstone, S 12/11/1976 2 (1 0) 1.4 Code a function HoursWorked that will calculate the hours that a worker worked in a month. The login and logout times of each worker per day for a specific month are saved in the text file D_times.txt. 1.4.1 Send the record number of a worker to the function as a value parameter. 1.4.2 Read each line in the text file D_times.txt. 1.4.3 If the first number in the line corresponds with the record number of the worker, the hours worked for that day must be calculated and added to the total hours of that worker. 1.4.4 Number of hours worked per session is worked out as follows: Begin Time End Time Hours Worked (hours) (hours) Ue 18 6 19 3 8 (19) Copyright reserved Please turn over GAUTENG
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 6 DBE/2012 SSE 7 Voltooi die kode vir die tweede opsie: [Loonstaat:]. Wanneer die gebruiker hierdie opsie kies, moet die program 'n opsomming vertoon van die lone wat dié maand aan elke werker uitbetaal is. Lees deur die verduideliking en maak seker jy verstaan wat gevra word. Voorbeeld van afvoer: Vertoon Werker-inligting: Loonstaat | gg Herstel | i Sluit | [AmaGluGlu Vulstasie || |Loonstaat vir April " i Van Naam Kategorie Loon | || |Mohamed Koos John 1 R 480.00 || |Livingstene Solomon 2 R 595.00 || |Du Plessis Gert Johan 3 R 440.00 || [Nel Willem Melt Louw 2 R 625.00 / Adams Petrus 1 R 30.00 || jLudama Petrus Abraham 1 R1.480.00 * || |Mmbono Kally Lucky 1 R1.630.00 * || |Ormando Raymond Julius Motie 1 R 330.00 || |Nabana Rama 1 R 450.00 || jJabu Julius Kamalu 3 R 110.00 || |Matshi Luitchi James Mai 1 Ro 420.00 i : || |Totaal: R 6,550.00 4 Doen die volgende: 1.5.1 Inisialiseer 'n veranderlike wat die totale bedrag van lone deur die vulstasie uitbetaal, sal bereken. 1.5.2 Die huidige maand se nommer moet vanaf die sleutelbord ingelees word. Neem aan die data in die teksléer is vir April (maand nommer 4). 1.5.3 Bepaal die maand se naam, byvoorbeeld maand nommer 2 is Februarie. 1.5.4 Voorsien die loonstaat van opskrifte en subopskrifte. 1.5.5 Bereken vir elke werker in die dataléer die ure wat elke werker gewerk het, deur die funksie UreGewerk te roep. Koper vorbonos JANN IIKT N22 9 seen (1) (1) (3) (1) (2)
Downloaded from hlayiso.com Computer Studies/HG/P1 6 DBE/2012 SCE 1.5 Complete the code for the second option: [Payment Statement:]. When the user chooses this option, the program should show a summary of the payments made to each worker in this month. Read through the explanation to make sure you understand what is asked. Example of output: Display Worker Info: Payment Statement | <o Retry | i Close | AmaGluGiu Petrol Station Payment Statement for April i Surname Name Category Salary Mohamed Koos John 1 R 480.00 Livingstone Solomon ‘4 R 595.00 Du Plessis Gert Johan 3 R 440.00 Nel Willem Melt Louw 2 R 825.00 Adams Petrus 1 R 90.00 Ludama Petrus Abraham 1 R 1,480.00 * Mmbono Kally Lucky 1 R1.630.00 * (Ormando Raymond Julius Motie 1 R 330.00 | |Nabana Rama 1 R 450.00 | abu Julius Kamalu 3 R 110.00 | |Matshi Luitchi James Mai 1 R 420.00 (Total: R 6,550.00 Do the following: 1.5.1 Initialise a variable to calculate the total amount of payments made by the station. (1) 1.5.2 The present month's number has to be entered from the keyboard. Assume the data in the text file is for the month of April (month number 4). (1) 1.5.3 Determine the month name, for example month number 2 is February. (3) 1.5.4 Provide the headings and subheadings to the payment statement. (1) 1.5.5 For each worker in the data file, work out the hours worked that month by calling the HoursWorked function. (2) Comin esoned NAN Pose tum over
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 1.5.6 1.5.7 1.5.8 1.5.9 1.5.10 7 DBE/2012 SSE Kodeer 'n prosedure-subprogram BerekenSalaris wat 'n werker se salaris sal bereken. Definieer die prosedure soos volg: Waardeparameters: Kategorie = kategorie van werker (Sien bylae — die kategorie bepaal wat die werker per uur betaal word.) Ure = die getal ure wat die werker gewerk het Verwysingsparameters: Salaris = die salaris van die werker LET WEL: Werkers wat meer as 45 uur gewerk het, ontvang 'n bonus van 12% op hul salaris. Roep die prosedure om die werker se salaris te bereken. Bereken of die werker 'n verjaarsdagbonus gaan ontvang. As dit die werker se verjaarsdagmaand is, ontvang hy 'n bonus van R1 000. Elke werker wat 'n verjaarsdagbonus ontvang, moet aangedui word met 'n ™' aan die einde van die reél. (Sien voorbeeld van afvoer.) Die totale bedrag uitbetaal aan salarisse moet bereken word en onderaan die loonstaat vertoon word. Die maand se naam en die totale bedrag uitbetaal aan salarisse vir die maand, moet aan die einde van die teksléer D_lone.txt geskryf word. Voordat die data na die léer geskryf word, moet die gebruiker eers toestemming gee om data na die léer te skryf. Vertoon 'n gebruikersvriendelike vraag, waarop die gebruiker slegs J vir Ja of N vir Nee kan antwoord. As die gebruiker toestemming gee om na die léer te skryf, moet 'n gebruikersvriendelike boodskap verskyn dat data bygevoeg is, andersins moet 'n boodskap vertoon word dat byvoeging geweier is. Maak voorsiening vir hoof- en kleinletter- toevoer. Lewer die XXXX volgende in vir VRAAG 1: ¢ Die volledige program, die eenheid gestoor as Vr1XXXX_u.pas, waar |, jou eksamennommer voorstel, en die projek gestoor as |, Vr1XXXX_p.dpr en = Vr 1XXXX_u.dfm. Maak = seker = jou | eksamennommer is boaan die program as 'n kommentaarstelling. : e ‘n Drukstuk van jou program. 7a se Kopiereg voorbehou UIUC AAO EA A Bieat om assevier GAUTENG (7) (2) (8) (3) (8) [801
Computer Studies/HG/P1 7 DBE/2012 SCE 1.5.6 Code a procedure subprogram CalculateSalary that will calculate 1.5.7 1.5.8 1.5.9 1.5.10 Downloaded from hlayiso.com the salary of a worker. Define the procedure as follows: Value parameters: Category = category of worker (See annexure — the category determines the worker's rate per hour.) Hours = the number of hours the worker worked Reference parameters: Salary = the salary of the worker NOTE: Workers who have worked more than 45 hours receive a bonus of 12% on their salary. Call the procedure to calculate the worker's salary. Calculate whether the worker is going to receive a birthday bonus. If it is the worker's birthday month, he receives a bonus of R1 000. Each worker who receives a birthday bonus has to be indicated by placing an ™' at the end of the line. (See example of output.) The total amount to be paid out to salaries has to be calculated and shown at the end of the payment statement. The name of the month and the total salary amount for the month have to be written at the end of the text file D_payments.txt. Before the data is written to the text file, the user must first give permission to write data to the file. Show a user-friendly question to which the user can only answer Y for Yes or N for No. When the user gives permission to write to the file, a user-friendly message must appear to say that data has been added, otherwise a message must be shown to state that adding has been denied. Accommodate upper and lower case input. Hand in the following for QUESTION 1: The completed program, the unit save as QuiXXXX_u.pas, where XXXX represents your examination number, the project saved as Qu1XXXX_p.dpr and QuiXXXX_u.dfm. Ensure your examination number is on the top of the program as a comment statement. A printout of your program. ee raEs ST Conran esoved ANA Pesotum oer (7) (2) (8) (3) (8) [80]
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 8 DBE/2012 SSE VRAAG 2: DELPHI [20] Hierdie vraag is gebaseer op die teksléer D_lesing.txt. Beskou BYLAE B vir die struktuur van die inhoud van die léer. Skep 'n nuwe projek en stoor dit as Vr2XXXX_u.pas en Vr2XXXX_p.dpr, in die léergids Vraag 2 ('XXXX' verteenwoordig jou eksamennommer). Wanneer die program uitvoer, moet die volgende koppelvlak op die skerm verskyn: Bepaal inhoud: | Verander die opskrif (‘caption’) van die vorm sodat dit jou eksamennommer bevat en voeg jou eksamennommer by as 'n kommentaarstelling in die UNIT. 2.1 Skryf 'n program wat die data in die teksléer D_lesing.txt na 'n tweedimensionele skikking sal lees. Unleaded 93 Unleaded 95 LRP | Diesel Lesing 1 Lesing 2 Lesing 3 2.2 Tel die kolomme se data bymekaar om te bepaal hoeveel brandstof uit elke tenk gepomp is. Koper voomonco ANNUAL, == 22/0 snr
Downloaded from hlayiso.com Computer Studies/HG/P1 8 DBE/2012 SCE QUESTION 2: DELPHI [20] This question is based on the text file D_reading.txt. Examine ANNEXURE B for the structure of the content of the file. Create a new project and save it as Qu2XXXX_u.pas and Qu2XXXX_p.dpr, in the folder Question 2 ("XXXX' represents your examination number.) When the program is executed, the following user interface should appear on the screen: FB Question 2: {examination Determine volume: Change the caption of the form to show your examination number and enter your examination number as a comment statement in the UNIT. 2.1 Write a program that will read the data in the D_reading.txt text file to a two- dimensional array. Unleaded 93 Unleaded 95 LRP | Diesel Reading 1 Reading 2 Reading 3 2.2 Add up the data in the columns to determine the amount of petrol that has been pumped out from each tank. comin esoned NA 0 Pesotum ove
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 9 DBE/2012 SSE 7 Waarsku die eienaar van die vulstasie deur die woord ONVOLDOENDE in rooi te skryf, as die inhoud van die tenk minder as 5 000 £ is. As die tenk se inhoud meer is as 5 000 2 is, moet die woord VOLDOENDE geskryf word. Voorbeeld van afvoer: | 2B Vraag2: {Eksame Bepaal inhoud: ; \Opsomming van Petrol verbruik in liters: Unleaded 93: Unleaded 95 LRP Diesel Petrol gebruik: 7280.31 16104.08 116444.71 12825 .63 ' Petrol stand: VOLDOENDE VOLDOENDE ONVOLDOENDE VOLDOENDE Lewer die volgende in vir VRAAG 2: ¢ Die volledige program, die eenheid gestoor as Vr2XXXX_u.pas, waar XXXX jou eksamennommer voorstel, en die projek gestoor as Vr2XXXX_p.dpr en Vr2XXXX_udfm. Maak seker jou | eksamennommer is boaan die program as 'n kommentaarstelling. e = 'n Drukstuk van jou program. a [20] TOTAAL AFDELING A: 100 Koper vorbnod LINN ALIIN| === 2222s
Downloaded from hlayiso.com Computer Studies/HG/P1 9 DBE/2012 SCE 2.3 Warn the owner of the petrol station by writing the word SUFFICIENT if the content is more than 5 000 2, and INSUFFICIENT in red, if the content in the tank is less than 5 000 2. Example of output: | SBF (Examination n Determine yolume: Summary of petrol used in litres: Unleaded 93 —- Unleaded 95 LRP Diesel i Petrol used: 7280.31 16104.08 116444.71 12825.63 | i Petrol capacity: SUFFICIENT SUFFICIENT INSUFFICIENT SUFFICIENT Hand in the following for QUESTION 2: ¢ The completed program, the unit saved as Qu2XXXX_u.pas, where XXXX represents your examination number, the project saved as Qu2XXXX_p.dpr and Qu2XXXX_u.dfm. Ensure your examination number is on the top of the program as a comment statement. A printout of your program. eS ae TOTAL SECTION A: Comriresned AA YA A Pesotum over [20] 100
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 10 DBE/2012 SSE AFDELING B: TURBO PASCAL VRAAG 3: TURBO PASCAL [80] Hierdie vraag is gebaseer op die dataléer P_werker.dat en die teksléer P_tye.txt. Bestudeer BYLAE A vir die struktuur van die inhoud van die léers. Jy word voorsien van 'n onvoltooide Turbo Pascal-program in die léergids Vraag 3. Maak die Turbo Pascal-léer Vr3XX_p.pas oop en stoor die eenheid (‘unit’) as Vr3XX_u.pas in die léergids Vraag 3 ('XX' verteenwoordig jou eksamennommer). Sleutel jou eksamennommer as 'n kommentaarstelling in die UNIT in. Die volgende opsies word vertoon sodra die program uitgevoer word: KIESLYS 1. Vertoon Werker-inligting 2. Loonstaat 3. Eindig Maak jou keuse <1/2/3> Doen die volgende: 1 Definieer die volgende datatipe: 'n Rekord-datatipe, TWerker, gebaseer op die rekordstruktuur van die werker- dataléer. LET WEL: Elk van hierdie veranderlikes moet as 'n parameter na en van die subprogramme gestuur kan word. (5) 3.2 Kodeer 'n funksie-subprogram genaamd VanVL. Hierdie funksie ontvang die van en name van die werker as parameters. Dit stuur die werker se van, gevolg deur sy voorletters, terug. Nie al die werkers het dieselfde getal name nie. Voorbeeld: Mohamed Koos John — Mohamed, KJ Livingstone Solomon — Livingstone, S (8) Keira vorbhay UNIAN AUUALANHINIRIANN! = 27om ass
Downloaded from hlayiso.com Computer Studies/HG/P1 10 DBE/2012 SCE SECTION B: TURBO PASCAL QUESTION 3: TURBO PASCAL [80] This question is based on the data file P_worker.dat and the text file P_times.txt. Examine ANNEXURE A for the structure of the content of the file. You are provided with an incomplete Turbo Pascal program in the folder Question 3. Open the Turbo Pascal file Qu3XX_u.pas and save the unit as Qu3XX_u.pas in the Question 3 folder ('XX' represents your examination number). Type your examination number in as a comment statement in the UNIT. The following options are shown as soon as the program is executing: OPTION LIST 1. Show Worker Info 2. Payment Statement 3. End Make your choice <1/2/3> Do the following: 3.1 Define the following data type: A record data type, TWorker, based on the record structure of the worker data file. NOTE: Each of these variables has to be able to be sent as parameters to subprograms. (5) 3.2 Code a function subprogram named Surlnit. This function receives the surname and names of the worker as parameters. It sends back the surname, followed by the initials of the worker. Not all workers have the same number of names. Example: Mohamed Koos John — Mohamed, KJ Livingstone Solomon — Livingstone, S (8) Copyrtgnt reserved EVO AT AME A A Pease turn over
Rekenaarstudie/HG/V1 11 DBE/2012 SSE 3.3 Voltooi die kode vir die eerste opsie: [Vertoon Werker-inligting]. Wanneer 3.4 Kopiereg voorbehou Downloaded from hlayiso.com die gebruiker dié opsie kies, moet die program: 3.3.1 3.3.2 Bepaal of die léer P_werker.dat bestaan. As die léer nie bestaan nie, moet 'n gepaste boodskap vertoon word. As die léer bestaan, moet die inhoud van die |éer P_werker.dat op die skerm vertoon word, in netjiese kolomme, met opskrifte en subopskrifte soos in die voorbeeld hieronder getoon. Roep die funksie-subprogram VanVL om die werker se naam in die verlangde formaat te vertoon. Werker-inligting: AmaGluGlu-vulstasie: Rekordnr.: = Naam: Geboortedatum: Kategorie: 1. Mohamed,KJ 15/09/1987 1 2 Livingstone,S 12/11/1976 2 Sh Du Plessis,GJ 08/09/1997 3 cus: Kodeer 'n funksie UreGewerk wat die getal ure wat 'n werker in die maand gewerk het, sal bereken. Die inteken- en uittekentye van elke werker per dag vir 'n spesifieke maand word in die teksléer P_tye.txt gestoor. 3.4.1 3.4.2 3.4.3 3.4.4 Stuur die werknemer se rekordnommer na die funksie as 'n waardeparameter. Lees reél vir reél uit die teksléer P_tye.txt. As die eerste getal in die reél ooreenstem met die rekordnommer van die werker, moet die ure gewerk vir daardie dag bereken word en by die totale ure gewerk vir daardie werker, getel word. Getal ure per sessie gewerk, word soos volg bereken: Begintyd Eindtyd Ure gewerk (uur) (uur) 12 18 6 19 3 8 FAUT AMET A Beat om assebler (2) (10) (19)
Computer Studies/HG/P1 11 DBE/2012 SCE 3.3 Complete the code for the first option: [Show Worker Info]. When a user Downloaded from hlayiso.com chooses this option, the program should: 3.3.1 Determine if the file P_worker.dat exists. If the file does not exist, a suitable message should be shown. 3.3.2 If the file exists, the content of the file P_worker.dat should. be shown on the screen in neatly defined columns with headings and subheadings, as shown in the example below. Call the function subprogram Surlnit to determine the worker's name in the asked format. Worker Info: AmaGluGlu petrol station: Record No.: Name: Date of Birth: Category: 1. Mohamed,KJ 15/09/1987 1 2. Livingstone,S 12/11/1976 z 3. Du Plessis,GJ 08/09/1997 Scic = 3.4 Code a function HoursWorked that will calculate the hours that a worker worked in a particular month. The login and logout times are saved in the text file P_times.txt. 3.4.1 Send the record number of a worker to the function as a value parameter. 3.4.2 Read each line in the text file P_times.txt. 3.4.3 If the first number in the line corresponds with the record number of the worker, the hours worked for that day must be calculated and added to the total hours of that worker. 3.4.4 Number of hours worked per session is worked out as follows: Begin Time End Time Hours worked (hours) | (hours) 12 18 6 19 3 8 Copyright reserved FETT ATO LUA A Please turn over GAUTENG (2) (10) (19)
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 12 DBE/2012 SSE 3.5 Voltooi die kode vir die tweede opsie: [Loonstaat:]. Wanneer die gebruiker dié opsie kies, moet die program 'n opsomming vertoon van die lone wat dié maand aan elke werker uitbetaal is. Lees deur die verduideliking en maak seker dat jy verstaan wat gevra word. Voorbeeld van afvoer: AmaGluGlu-vulstasie Loonstaat vir: April Van Naam Kategorie Salaris Mohamed Koos John 1 R_ 480.00 Livingstone Solomon 2. R_ 595.00 Ludama Petrus Abraham 1 R 1480.00 * Totaal: R 6550.00 Doen die volgende: 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 Kopiereg voorbehou Inisialiseer 'n veranderlike wat die totale bedrag van lone deur die stasie uitbetaal, sal bereken. Die huidige maand se nommer moet vanaf die sleutelbord ingelees word. Neem aan die data in die teksléer is vir April (maand nommer 4). Bepaal die maand se naam, byvoorbeeld maand nommer 2 is Februarie. Voorsien die loonstaat van opskrifte en subopskrifte. Bereken vir elke werker in die dataléer die ure wat elke werker gewerk het, deur die funksie UreGewerk te roep. Kodeer die prosedure-subprogram BerekenSalaris wat 'n werker se salaris sal bereken. Definieer die prosedure soos volg: Waardeparameters: Kategorie = kategorie van werker (Sien bylae — die kategorie bepaal wat die werker per uur betaal word.) Ure = die getal ure wat die werker gewerk het Verwysingsparameters: Salaris = die salaris van die werker LETWEL: Werkers wat meer as 45 uur gewerk het, ontvang 'n bonus van 12% op hul salaris. EITM IA A Bieat om assobier GAUTENG (1) (1) (3) (1) (2) (7)
Downloaded from hlayiso.com Computer Studies/HG/P1 12 DBE/2012 SCE 3.5 Complete the code for the second option: [Payment Statement:]. When the user chooses this option, the program should show a summary of the payments made to each worker in this month. Read through the explanation to make sure you understand what is asked. Example of output: AmaGluGlu petrol station Payment Statement for: April Surname Name Category Salary Mohamed Koos John 1 R_ 480.00 Livingstone Solomon 2 R_ 595.00 Ludama Petrus Abraham 1 R 1480.00 * Total: R 6550.00 Do the following: 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 Copyright reserved Initialise a variable to calculate the total amount of payments made by the station. The present month's number has to be entered from the keyboard. Assume the data in the text file is for the month of April (month number 4). Determine the month name, for example month number 2 is February. Provide the headings and subheadings to the payment statement. For each worker in the data file, work out the hours worked that month by calling the HoursWorked function. Code the procedure subprogram CalculateSalary that will calculate the salary of a worker. Define the procedure as follows: Value parameters: Category = category of worker (See annexure — the category determines the worker's rate per hour.) Hours = the number of hours the worker worked Reference parameters: Salary = the salary of the worker NOTE: Workers who have worked more than 45 hours receive a bonus of 12% on their salary. CUT AT AA A A Pease tum over GAUTENG (1) (1) (3) (1) (2) (7)
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 3.5.7 3.5.8 3.5.9 3.5.10 13 DBE/2012 SSE Roep die prosedure om die werker se salaris te bereken. Bereken of die werker 'n verjaarsdagbonus gaan ontvang. As dit die werker se verjaarsdagmaand is, ontvang hy 'n bonus van R1000. Elke werker wat 'n verjaarsdagbonus ontvang, moet aangedui word met 'n ™' aan die einde van die reél. (Sien voorbeeld van afvoer.) Die totale bedrag uitbetaal aan salarisse, moet bereken word en onderaan die loonstaat vertoon word. Die maand se naam en die totale bedrag uitbetaal aan salarisse vir die maand, moet aan die einde van die teksléer P_lone.txt geskryf word. Voordat die data na die teksiéer geskryf word, moet die gebruiker eers toestemming gee aan die program om data na die léer te skryf. Vertoon 'n gebruikersvriendelike vraag, waarop die gebruiker slegs J vir Ja of N vir Nee kan antwoord. As die gebruiker toestemming gee om na die léer te skryf, moet 'n gebruikersvriendelike boodskap verskyn dat data bygevoeg is, andersins moet 'n boodskap vertoon word dat byvoeging geweier is. Maak voorsiening vir hoof- en kleinletter-toevoer. Kopiereg voorbehou Lewer die volgende in vir VRAAG 3: e Die volledige program, die eenheid gestoor as Vr3XX_u.pas, waar XX : jou eksamennommer voorstel. Maak seker jou eksamennommer is boaan die program as n kommentaarstelling. e = 'n Drukstuk van jou program. FAINT AO A Bieat om assenier (2) (8) (3) (8)
Downloaded from hlayiso.com Computer Studies/HG/P1 13 DBE/2012 SCE _ Call the procedure to calculate the worker's salary. (2) 3.5.8 Calculate whether the worker is going to receive a birthday bonus. If it is the worker's birthday month, he receives a bonus of R1 000. Each worker who receives a birthday bonus has to be indicated by placing an ™' at the end of the line. (See example of output.) (8) 3.5.9 The total amount to be paid out to salaries has to be calculated and shown at the end of the payment statement. (3) 3.5.10 The name of the month and the total salary amount for the month have to be written at the end of the text file P_payments.txt. Before the data is written to the text file, the user must first give permission to the program to write data to the file. Show a user- friendly question to which the user can only answer Y for Yes or N for No. When the user gives permission to write to the file, a user- friendly message must appear to say that data has been added, otherwise a message must be shown to state that adding has been denied. Accommodate upper and lower case input. (8) Hand in the following for QUESTION 3: e The completed program, the unit saved as Qu3XX_u.pas, where XX represents your examination number. Ensure your examination number is on the top of the program as a comment statement. A printout of your program. Ties z Eereasaer eye EE aE [80] Crs TTT Ce
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 14 DBE/2012 SSE VRAAG 4: TURBO PASCAL [20] Hierdie vraag is gebaseer op die teksléer P_lesing.txt. Beskou BYLAE B vir die struktuur van die inhoud van die léers. Skep 'n Turbo Pascal program en stoor dit as Vr4_uXX.pas in die Vraag 4-léergids (XX' verteenwoordig jou eksamennommer). Voeg jou eksamennommer by as 'n kommentaarstelling in die UNIT. 4.1 Skryf 'n program wat die data in die teksléer P_lesing.txt na 'n tweedimensionele skikking sal lees. Unleaded 93 Unleaded 95 LRP | Diesel Lesing 1 Lesing 2 Lesing 3 4.2 Tel die kolomme se data bymekaar om te bepaal hoeveel brandstof uit elke tenk gepomp is. 4.3 Waarsku die eienaar van die vulstasie deur die woord ONVOLDOENDE in rooi te skryf, as die inhoud van die tenk minder as 5 000 2 is. As die tenk se inhoud meer as 5 000 £ is, moet die woord VOLDOENDE geskryf word. Voorbeeld van afvoer: Opsomming van petrol gebruik in liter: Unleaded 93 ~~ Unleaded 95 LRP Diesel Petrol gebruik: = 7280,31 16104.08 115444.71 12825.63 Tenkkapasiteit! VOLDOENDE VOLDOENDE ONVOLDOENDE VOLDOENDE Lewer die volgende in vir VRAAG 4: e Die volledige program, die eenheid gestoor as Vr4XX_u.pas, waar XX jou | eksamennommer voorstel. Maak seker jou eksamennommer is boaan die | program as 'n kommentaarstelling. e ‘n Drukstuk van jou program. [20] TOTAAL AFDELING B: 100 ahaa UOT AAO IU A A
Downloaded from hlayiso.com Computer Studies/HG/P1 14 DBE/2012 SCE QUESTION 4: TURBO PASCAL [20] This question is based on the text file P_reading.txt. Examine ANNEXURE B for the structure of the content of the file. Create a Turbo Pascal program and save it as Qr4-uXX.pas in the Question 4 folder (XX' represents your examination number). Enter your examination number as a comment statement of the UNIT. 4.1 Write a program that will read the data in the P_reading.txt text file to a two- dimensional array. Unleaded 93 Unleaded 95 LRP _| Diesel Reading 1 Reading 2 Reading 3 4.2 Add up the data in the columns to determine the amount of petrol that has been pumped out from each tank. 4.3 Warn the owner of the petrol station by writing the word SUFFICIENT if the content is more than 5 000 2, and INSUFFICIENT in red, if the content in the tank is less than 5 000 £. Example of output: Summary of petrol used in litres: Unleaded 93 Unleaded 95 LRP Diesel Petrol used: 7280,31 16104.08 115444.71 12825.63 Tank capacity: SUFFICIENT SUFFICIENT INSUFFICIENT SUFFICIENT Hand in the following for QUESTION 4: e The completed program, the unit saved as Qu4XX_u.pas, where XX represents your examination number. Ensure your examination number is on the top of the program as a comment statement. e Aprintout of your program. [20] TOTAL SECTION B: 100 Comviotesoved! YA AA
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 DBE/2012 SSE BYLAE A: DATASTRUKTURE VRAAG 1 (DELPHI) EN VRAAG 3 (TURBO PASCAL) Die data vir elke werknemer by die vulstasie word in die volgende dataléers gestoor: e D_werker.dat vir Delphi e P_werker.dat vir Turbo Pascal Die struktuur van die rekords in die dataléer is soos volg: VELD BESKRYWING DATATIPE Van Werker se van String van maksimum 20 karakters Voornaam(-name) | Werker se voorname. | String van maksimum 20 Dit kan enige getal karakters name wees, geskei met spasies. GeboorteDatum Werker se String van maksimum 10 geboortedatum indie | karakters volgende formaat: DD/MM/JJJJ Kategorie Die werker se Integer (Heelgetal) kategorie: 3: Toesighouer 2: Kassiere 1: Petroljoggie Die volgende is 'n drukstuk van 'n gedeelte van die data wat in die léer is: Mohammed Koos John 15/09/1987 4 Livingstone Solomon 12/11/1976 2 Du Plessis Gert Jan 08/09/1997 3 Nel Willem Melt Louw 12/07/1977 2 Adams Petrus 03/02/1990 1 Belangrike inligting: Werkers word volgens kategorie betaal: ° Kategorie 1: R30 per uur Kategorie 2: R35 per uur ° Kategorie 3: R55 per uur Koplereg voorbeniou FOI UU TAO A A
Downloaded from hlayiso.com Computer Studies/HG/P1 DBE/2012 SCE ANNEXURE A: DATA STRUCTURES QUESTION 1 (DELPHI) AND QUESTION 3 (TURBO PASCAL) The data for each worker at the petrol station is saved in the following data files: e D_worker.dat for Delphi e P_worker.dat for Turbo Pascal The following is an example of the structure of the data in the file: FIELD DESCRIPTION DATA TYPE Surname Worker's surname String of maximum 20 characters Name(s) Worker's names. It can | String of maximum 20 be any number of characters names with spaces in between. DateOfBirth Worker's date of birth in | String of maximum 10 the following format: characters DD/MM/YYYY Category The worker category: Integer 3: Foreman 2: Cashier 1: Petrol worker The following is a printout of a part of the data in the file: Mohammed Koos John 15/09/1987 1 Livingstone Solomon 12/11/1976 2 Du Plessis Gert Jan 08/09/1997 ] Nel Willem Melt Louw 12/07/1977 2 Adams Petrus 03/02/1990 1 Important information: Workers are paid according to category: o Category 1: R30 per hour o Category 2: R35 per hour o Category 3: R55 per hour Se ti CATT ATA EUG A A
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 DBE/2012 SSE Werkers teken elke dag in en uit vir werk. Die inteken- en uittekentye word in 'n teksléer gehou. e =D_tye.txt vir Delphi e ~=©P_tye.txt vir Turbo Pascal Voorbeeld van die inhoud van die teksléer: 3,7,16 11,8,23 2,5,21 5,10,3 1,15,20 ... Belangrike inligting: e Getalle word met kommas geskei. e Die eerste getal is die werker se rekordnommer in die léer. e Elke werker se rekordnommer kan op die meeste 30 keer in die léer verskyn. e Tye word in digitale formaat ingelees. Dus sal 10 uur in die aand 22 uur wees. e ~~ Daar is 24 uur in 'n dag. e Die tweede getal is die intekentyd, en die derde getal is die uittekentyd. LET WEL: Wanneer die getal ure gewerk per dag, bereken word, hou in gedagte dat 'n werker nagskof of dagskof kan werk, afhangend van die inteken- en uittekentye wat in die léer aangeteken word. e Vir die doel van hierdie program word aanvaar dat alle werkers op die uur begin werk en ophou werk. Geen halfuur- en kwartiersessies hoef in berekening gebring te word nie. Geld word elke maand aan werkers betaal en 'n opsomming van wat elke maand uitbetaal is, word in 'n teksléer gestoor. e =D_lone.txt vir Delphi e ~=P_lone.txt vir Turbo Pascal Voorbeeld van die inhoud van die léer: Januarie, R4,700.00 Februarie, R7,500.00 Maart, R4,450.00 lineal FEIT IAA A GAUTENG
Downloaded from hlayiso.com Computer Studies/HG/P1 DBE/2012 SCE Workers have to log in and out every day. The logged times are kept in a text file. e D_times.txt for Delphi e P_times.txt for Turbo Pascal Example of the content of the text file: 3,7,16 11,8,23 2,5,21 5,10,3 1,15,20 ... Important information: e Numbers are separated by commas. e The first number is the record number of the worker in the file. e Each worker's record number can appear 30 times at most in the file. e Times are recorded in digital format. Thus: 10 in the evening will be 22 hours. e There are 24 hours in a day. e The second number in the logged data is the time in and the third number represents the time out. NOTE: When working out the number of hours worked per day, keep in mind that a worker can either work night shift or day shift, depending on the login and logout times recorded in the file. e For the purpose of this program it is assumed that all the workers begin and leave work on the hour. No half and quarter hours have to be calculated. Payments are made to workers every month, and a summary of what has been paid out per month is kept in a text file. e D_payments.txt for Delphi e P_payments.txt for Turbo Pascal Example of the content of the file: January, R4,700.00 February, R7,500.00 March, R4,450.00 Cony saved N10 0
Downloaded from hlayiso.com Rekenaarstudie/HG/V1 DBE/2012 SSE BYLAE B: VRAAG 2 (DELPHI) EN VRAAG 4 (TURBO PASCAL) By die vulstasie word vier tipes brandstof verkoop: Unleaded 93 Unleaded 95 LRP Diesel Elk tenk bevat 40 000 £. Elke agt uur (lengte van dag = 24 uur) word 'n meterlesing geneem om die hoeveelheid brandstof wat uit die verskillende tenks uitgepomp is, te bepaal. Dié lesings word in 'n teksléer gestoor. . D_lesing.txt vir Delphi e —_ P_lesing.txt vir Turbo Pascal Beskrywing: Lesing no. Pomp no. Liter uitgepomp Lengte = 1 karakter Lengte = 1 karakter Lengte = 10 karakters Toon nommer van Pompno. Getal liter uitgepomp in meterlesing vir die dag. 1 = Unleaded 93 8 uur. (Rynommer) 2 = Unleaded 95 (Inhoud van 3 =LRP tweedimensionele 4 = Diesel skikkings) (Kolomnommer) Die inhoud van die teksléer lyk soos volg: 11 1380.67 —- Lesing 1, Pomp 1, 1380.67 liter uitgepomp. 1 2 5341.31 1 3 2530.12 1 4 4369.57 2 1 2551.04 2 2 6229.72 23 9177.72 ... ens. Kopiereg voorbehiou FTO UA E08 A GAUTENG
Downloaded from hlayiso.com Computer Studies/HG/P1 DBE/2012 SCE ANNEXURE B: QUESTION 2 (DELPHI) AND QUESTION 4 (TURBO PASCAL) At the petrol station, four types of fuel are sold: e Unleaded 93 ° Unleaded 95 ° LRP e Diesel Each tank contains 40 000 ¢. Every eight hours (length of day = 24 hours) a meter reading is taken to determine the amount of fuel pumped out of the different tanks. These readings are stored in a text file. e D_reading.txt for Delphi ° P_reading.txt for Turbo Pascal Description: Reading No. Pump No. Litres pumped out Length = 1 character Length = 1 character Length = 10 characters Show the reading Pump No. Amount of litres pumped number for the day. 1 = Unleaded 93 out in 8 hours. (Row number) 2 = Unleaded 95 (Content of two- 3 =LRP dimensional arrays) 4 = Diesel (Column number) _ The content of the text file looks as follows: 11 1380.67 - Reading 1, Pump 1,1380.67 litres pumped out. 1 2 5341.31 1 3 2530.12 1 4 4369.57 2 1 2551.04 2 2 6229.72 239177.72 ... etc. Coprintesoves NAA

Study this subject

More from Grade 12 Information Technology

View all