Skip to content

Information Technology Grade 11 P1 2017 Memo

MemorandumInformation TechnologyGrade 11201716 pages

Grade 11 Information Technology Paper 1 memorandum from the KwaZulu Natal June 2017, 16 pages. Read online or download the free PDF.

Free to read online, no sign-up needed

Loading document…

Loading document…

KwaZulu Natal June 2017

Document textSearch extracted text and jump to a page.
Downloaded from hlayiso.com education ®) Department: Moda Education " PROVINCE OF KWAZULU-NATAL GREENBURY SECONDARY SCHOOL INFORMATION TECHNOLOGY P1 GRADE11 JUNE EXAMINATIONS - 2017 MARKS: 150 ~ TIME: 3 hours EXAMINER(S) : MRN BRULAL (Apollo Secondary) MODERATOR(S) : MRMGEBREAB — (Northwood Boys High) This question paper consists of 11 pages. Page 1 of 11
Downloaded from hlayiso.com INSTRUCTIONS AND INFORMATION 1. This is a three-hour examination. 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. You require the files listed below in order to answer the questions. They are EITHER on a stiffy disk OR CD issued to you, OR the invigilator/educator will tell you where to find them on the hard drive of the workstation you are using OR in which network folder it is. If the files are issued to you on a CD, you need to copy them onto your hard disk. QUESTION 1 Customer_p.pas Customer_p.dfm Customer_p.dpr QUESTION 2 delegates.txt strings_p.pas strings_p.dfm strings_p.dpr QUESTION 3 Array_p.pas Array_p.dfm Array_p.dpr Save your work at regular intervals as a precaution against power failures. Read ALL the questions carefully. Do only what is required by the question. During the examination you may use the manuals originally supplied with the hardware and software. You may also use the HELP functions of the software. You may NOT refer to any other resource material. At the end of this examination session you will be required to hand in the stiffy or CD given to you by the invigilator with your work saved on it, or you must make sure that all your work has been saved on the network as explained to you by the invigilator/educator. Ensure that all files can be read. You also have to hand in printouts of the programming code for all the questions you have done. All printing of programming questions will take place within an hour of the completion of the examination. Page 2 of 11
Downloaded from hlayiso.com SCENARIO The /se/wini municipality is one of the local municipalities in KZN. They are in the process of upgrading their existing software and have asked for your assistance in this regard. QUESTION 1- GENERAL PROGRAMMING The municipality would like to develop an application that could be used to calculate and view customer’s utility bills. You have been supplied with the following form in the project called Customer_p Date» Be sone (ela One Code event handlers for the following buttons/components Ld Button]Question 1.1] Write Delphi code to display the current/system date in the label /b/Date in the format eg 24 May 2017 1.2 Button [Question 1.2] The estimated water consumption in kilolitres(kl) for the consumer is currently displayed in the spin edit (spn WaterCons) The water bill amount is determined in the following way : © The first 8kl is free (no charge) @ The next 22kI is charged at R7.56 per kl « The remainder is charged at R14.09 per kl Using the above criteria and the estimated water consumption value, determine the water bill amount. Display this value in the label (/b/WaterBill) (See sample output on next page) (2) (5) Page 3 of 11
Downloaded from hlayiso.com 13 Button [Question 1.3] i - Randomly generate a previous meter reading in the range 10100 to 20200 and display this value in the edit (edtPrev) - Retrieve the current meter reading from the edit (edtCurr) - If the current meter reading is less than previous reading, then : o clear the edit (edtCurr) : 9 prompt the user, with a dialog box, to enter a valid value in the edit to proceed . - The number of kiloWatthours(k\Wh) consumed is represented by the difference in the meter readings while the electricity tariff is 89c per kWh, Calculate the electricity bill amount using the data supplied and display this value in the edit (edtF/ect) in currency format (8) 14 Button [Question 1.4] : The annual rates amount charged is based on the current value of the property and the type of property The property can either be a commercial property or residential property The following is applied in the calculation of the rates : ¢ No rates are applied to properties under R8O 000 * The rates tariff is 1.8 cents per rand, based on the value of the property ¢ For residential properties, the first R15 000 is exempted frorn the rates calculation Read in the property value from the edit (edtPropVal) and the type of property from the radio group, then calculate the rates amount due. Display this value in the edit (edtRate) (12) Page 4 of 11
1.5 ~ Downloaded from hlayiso.com Button [Question 1.5] The payment of the rates is usually done in the following manner : «The first payment is calculated as 15% of the rates amount ¢ Thereafter this amount is deducted from the rates amount with the remaining balance to be paid in equal instalments over 11 months Retrieve the account number and rates value, from the respective edits. Display the account number at the top , then: Calculate and display the month, the amount to be paid monthly and the decreasing balance in neat columns with suitable headings. The amounts must be displayed in currency format, correct to two decimal places Account No + 7452187 Month Monthly payment Balance i FoI, 50 R2 055,50 2 Rig7.77 RIB? 7R 3 RAS? 77 R1689,95. 4 RAgy. 77 Ri502, 18 5 RABAT? RAIL 6 lg? 77 Roa 126.64 F R87. 77 R9G8.86- 3 RAB7.77 RSL EJ RAB? 77 RS6S.32 10 RIGV.7? RSV555 Ad RABAT? RAg7? 12 AQF? RO.00 ‘ (10) SUB TOTAL 37 Page 5 of 11
Downloaded from hlayiso.com “QUESTION 2- STRING HANDLING & TEXT FILES 21 2.1.3 Tabsheet : Conference The municipality will be holding a national conference at the Durban ICC in July, where delegates at the conference will be representing their provinces. Details of delegates attending the conference, will be captured using the following form Ee ES ta province Button[Verify ID Number] Validate the ID number in the edit (ed#/D), as only a 13 digit ID number will be acceptable, If an ID number does not meet this requirement then, the edit should be cleared and the user should be continuously prompted(via a dialog box) to enter their ID number, until a valid ID number is entered. Display the valid 1D number in the edit box edt/D (5) Button[Provincial Code] Declare a global variable provCode of type string. Retrieve the province selected by the user from the combo-box, and use it to determine the provincial code of the delegate. The provincial code is derived as follows : * If the province consists of a single word, then the code is the first three letters of the province in uppercase eg. Gauteng = GAU ¢ If the province consists of two words, the code becomes the first letter of each word in the name in uppercase eg. Kwazulu Natal = KN Store the code in the variable provCode (6) Button[Registration Code] Each delegate will be issued with a registration code, which ts derived as follows : ¢ First three digits are the last three letters of surname « Next three digits are the 7 , 8h and 9% digits of the ID number ¢ Next character is a hyphen (-) if the delegate is not requiring accommodation or a hash(#) if they are requiring accommodation « Followed by the provincial code Page 6 of 11
2.1.4 2.2 Downloaded from hlayiso.com NOTE: > Registration code must be in uppercase ! > Store the registration code in a global variable RegCode |Govender ee Mpumalanga pERsaaeapu Button| Register Delegate] This button will.display the details of the delegate in the rich edit as confirmation of his registration for the conference. Display the following details : Initial & Surname : Eg RD Pillay Province : Eg Gauteng (8) Accomodation Required : Yes/ No Registration Code : Eg LAY453-GAU Tabsheet : Delegates You are supplied with a text file called delegates.txt which contains details of registered delegates attending the conference. Each line of this delimited text file contains details of the delegate in the following format : Initial & Surname @Province@ Y or N ( indicating if accommodation is required) Eg TR Bantho@Western Cape@N T Harridas@Gauteng@Y Code event handlers for the following : Note that the buttons : ‘Display Stats’ and ‘Budget Costs’ are disabled Page 7 of 11
Downloaded from hlayiso.com 2.2.1 - Button[Check Text File] Check that the text-file ‘delegates.txt’ exists, then using dialogue boxes : © display a confirmation message and enable the remaining buttons, if the text file is located OR o display an appropriate error message in the event that the text file cannot be found (4) 2.2.2 Button[Display Stats] : Retrieve the selected province from the combo-box Read the text-file and separate and display the details of the text-file in the rich edit in tabular form with suitable headings In addition determine and display the : a) total number of delegates for the conference b) number of delegates requiring accommodation c) number of delegates from the selected province HINT : Use global variables ! Pero ES, PROWINCE, ACCOM ATION TR. Bartha. Western Cape ml T aericas: Gaurbery a LL eteariedy, Geuiteng ye is Gowender Kvwseulu Mattel Wh IT Msobe Lrapepa v BT tettsibalt Mpurialariga “Ht FF shail Gauteng » E Diorsiwedia Prem state vw FED. Pollen ye Kuveszuill Parbeal MN MI Rerndsali Weabern Cape oe 3G Pirie: Mhorth Wiest tl Pa telerinauetina Lirapogia tl Pd Abella Westen Cape ¥ ie etirealedl Bihomthy Witersi: i Ce Chetty Free State ie ALtMobernerd Marth West: int LPillerye Mpumalanga a TT oMyrtyle Northen Cape ‘yr (SB. Snitth Kyusceui Merkel cd FEE Pillay Gauteng mM aM Hasina tic orth Wiest v Murmiver of delegates. 22 Muapiver requiring acnornedeation Uz Muniber from itwszubs Me ted is 3 (l 2) Page 8 of 11
2.2.3 Downloaded from hlayiso.com Button[Budget Costs] The municipality will spend the following costs towards the hosting of the delegates for this conference : Aspect Cost per delegate Subsistence cost per delegate R135.00 Accommodation cost R560,00 The total allocated budget for this is R400 000. Determine and display the following: a) the total subsistence cost b) the accommodation cost c) total cost for hosting the delegates If the total cost exceeds the allocated budget then activate the hidden panel, pniBudget (7) SUB TOTAL 50 QUESTION 3 — ARRAYS The admin manager needs to make reservations and bookings for the delegates who will be requiring accommodation. Each delegate will only be accommodated for 2 nights at any local hotel, The names of 8 local hotels and the rates they charge per night are stored in two arrays. An application has to be developed to control bookings at the hotels. The form has the following layout : 3.1 Declare a one-dimensional array called arrRoomsto store the number of rooms available in each hotel. (2) Declare two global variables called nBookings(counts the number of bookings to be made), and total(totals the amount paid to hotels for the bookings) (2) Page 9 of 11
3.1.3 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 Downloaded from hlayiso.com Create an onActivate event for the form to display the hotels (from the given array atrHoiels) in the list box. You should also initialise the variables nBookings and total (3) Now code the following as instructed : Button[Generate Data] . Randomly generate values in the range O to 10 and store in the array arrRooms, These values represent the number of rooms available for booking per hotel ! Display a message in a dialog box, indicating that the values have been generated (5) Button [Display Data] Display the data from the arrays in tabular format in the rich-edit, with suitable headings as shown below. Display an additional message indicating that the hotel is fully booked , alongside any hotel that has no rooms available, HOTEL. ROOMS RATE PER NIGHT Parkly Hotel @ A5S4.65: MogesSardens: y RASE.BT The Selby 4 RSS, 25 The Maharaja 4 , REIL : Hobel Bartlet a RE5AR The Delphine o RoGA00 Fully booked! Holiday Inn & RI6S.92 (]/Protea Sands a RASA (5) | Button[Highest Rates] | Determine and display in the rich edit, the hotel together with the rates amount, of | the hotel with the highest rates. | Highest Rete is h765.92 charged by Holiday Inm (6) Function avgRates Code a function called avgRates, that will calculate and return the average rates amount charged by the hotels Button[Average rates] Display the average rates amount in the rich-edit , with a suitable message, by making a call to the function avgRates (7) Button[ Check Availability] This must allow. the user to select a hotel from the list box, input the number of rooms to book (via a dialogue box), and determine if there are rooms available in the selected hotel to accommodate the booking request. Display a message accordingly in the rich edit. If the booking can be made, also enable the panel ‘pn/Booking’, which must reflect the name of the selected hotel, the number of rooms to be booked as well as the rate charged by that hotel > |The Maharaja (10) Page,10 of 11
3.2.6 3.2.7 Downloaded from hlayiso.com Button[Confirm Booking] Write code that will simulate the reservation of the booking at the requested hotel. Do the following : fe} fo) ° fe) 3° Note ; update the number of rooms available (arrRooms), for the selected hotel. keep a tally of the total number of rooms being booked (use global variable declared) determine an accumulated total of the amount being paid for the bookings display a confirmation message in a dialogue box, indicating that the reservation has been made hide the panel pn/Booking this process can then continue, so as to book all delegates into hotels, and thereby obtain the totals for number of delgates/rooms being booked ! (6) Button[Summary] Display the details of the bookings as follow : fe} ce) The total number of rooms booked The total cost of the booking reservations (2) SUB TOTAL 48 TOTAL = (135 *10) / 9 = 150 be Page 11 of 11
Downloaded from hlayiso.com
Z¢_ | ENOLLSINS TWLOL ans unos AUBLIND fpue fpua esr 1 ((2'L ‘houszmmgz3 Teg) s73g0LOTE +6#644 (2/1 “ADUOAINO TZ ‘APquow) FTAISOLAPOTA +0#+ (T) TISOLIUT) ppw’ seuprAeTdstqper yy ‘Xequow-Teq =: Teq ut6eq = AW ZL 04 Z=t T Tox A §((e'LAOusrINgTT Tq) ATASOLIwLOTA oO +OHeH+ (ZL ‘Aouezangsz /Ked) 74S0LIOTA+GH+ Ts) DPE“ SoUTT-ACTAstqper fo) OT | {(,e0ueTed, +644, queuhed ATuQWON, +644, GQUOH, )ppy*seutT*Aetdstqpez 1 #(3X9LDO"IpE+, TequMU yUNODOY, ) ppy soUTT-FeTdstaper Ww id f09T=:, [zlqean-yderbereg:ketdstqper — Z 100T=: [T] qea-Uderbereg Aetdstaper ~ fOS =: [0] qea-yderbereg-Aetdstapex So ‘€=: qunooqey -uderbereg *AeTdstqper —= A” fTT/Teq =: Kequow id ~ tKed-soyer =: Teq /” #ST"Oxseqer =: Aed # (QXeL" eqewape) JeoTHoLIAg =: seqex = utBeq fo) ¢zebequr :f fTeex : Aequom/Aed/Teq/seqyer a zea ye {(a0efaoE trepuss) xOTTOCuCIINE"TwxOgL sanpssozd! ¢'T TO ipue (Y) A 4(Z‘L pextayZ 'SOVeT) JIISOLIWOT| =: AKeL-9qeyps O ipue So : A 40 =: sozez upbeq oO /A eSTO"JT peqseu // aste — pu ; / #8T0°Ox~ (000ST-TeAd) =: soqez = upbeq Zt usur~ (00008=<TeAd) pue, (T=xepurmejr-dozad6z) gt oO este pue a AP tTeAds8T0"O =: seqez utseq ueur,~ (00008 =< Tead) pue, (Q=xepurweiz-dozgd6z) zt Z” # (9x91 TeAdoza3pe) yeotgogzys =: TeAd uTéeq iurzys : edkzd f[eez : soqez/Tead wea f(q0efaon tzepues) YOTTOZUCJInE “Two, ernpsodzd| yt 7pus A ASL KowerangT3 TT A2) ATISOTIOTA =72KS," IS THIS A” 468°0xWHE =? TITEe A fad = yd =: aay fpue A” #((./,}0Moewe pTTea e zeqUg,/,eIeG,)xogandur) jurogzIg =: wo A tzeeTQ" TINQApe uTbeq, A usu? ad > yO FT AJ? (axeg*amg3ape) JuLOLZ1g =: yo Lf (ad) zagozaur =:3¥en-aergqpe A 4 (10202 ‘O0TOT) ebuemmopuey =: yd utbeq syeez : TTTee fmeBequt : umy/yo “ad zea # (qo0efaos, :zepuss) ¥OTTOTUOIANE*TuA0gs ermpesord| ET 7pue A” ‘te’_tKowuszanggz ‘ryDm) S7ASCLICOTA +, TTA ToIEM, =:uoTAdeg- TITex0IeMTaT fpue 0 Sayon uTBeq UsUz B=>peSyA FT fpue PZ '9S" Lx (G-PeeHA) =: Bryon utbeq AeUT (ZZ=> PeSEM) Pue ( g< POEM) FT {pues AZ 460° PL (OE-PESHM) 49S°La7Z 2 BxyoM upbeg AVOUI Of=< PeogM JT fonTeAstogzezemuds =: peoym upbegq f[eez : Bayom fzeHequt : peoym zea # (Qeelgqou izepues) HOT TOFUOIINE-TuCTR exnpesozrd| TT tpue A *(92ep/, KAKA uum p,) adutzeqeqqemmog=:uopadeg‘aqeatart utseq {(q0efoog :zepues) yoTTOSUOIANE“TwIOg, eInpesoxd TT LNOLSINO OWSW ONDRIV Vd LaaVvud ADOTONHDIL NOLLVWRIOINI 4102-SNOLLWNIWVXd JNOE
® Downloaded from hlayiso.com QUESTION 2 Zia [procedure TForml .btnRegCandClick (Sender: TObject)7 214 [procedure T¥orml .Button?Click (Sender: TObject) 7 var var init, fixstN : string; id :string: Integex; begin begin id := edtID. Text; ¥ firstN edtEN. Text; while length(id)<> 13 do ¥ if pos(' ',firstN)=0 then begin begin edtID.Clear; ¥ init :suppercase(firstN[1])+' 'tedtSN.Text; ¥ id := InputBox('Data', "Enter valid ID number", '") end end; else edtID.Text:= id; ¥ begin end; init := firstN[1]; for I := 2 to length(firstN)do begin 212 | procedure TFormi.Button4Click (Sender: TObject); if firstN[ij=" ' then ¥ var begin prov :string; init uppercase (init+firstN[i+l]); ¥ posSpe : integer; end; begin end; prov:= cmbProv.text; ¥ init i= init+? 'tedtsN.text; “ posSpe := pos(" ',prov); ¥ end | Lf posSpe=0 then % redbisplay.Lines.Add('Initials ¢ Surneme : '+init); begin redDisplay.Lines.Add('Province :'+cmbProv.Text) 7 ¥ provCode := UpperCaseY (copy(prov, 1,3) “)7 if chbAcc.Checked then end begin cise redDisplay.Lines-Add('Accomodation required : Yes"); begin end provCode := uppercase (prov[1]+prov[posSpce+i]); ¥ else f end; begin | end; redDisplay-Lines.Add('Accomodation required : No'); | vv end; — redDisplay-Lines-Add('Registration Code :'+regCode); 213 | procedure TForml.Buttonsclick (Sender: TObject) saz - vax 224 | procedure Form .ButtoniClick (Sender: ?Object); surN ,id,last3 : string; ee begin tf£ile : textfile; surN := edtSN.Textr begin . id r= edtID. Text; W if Filekxists('delegates.txt') ¥ then last3 := copy(surN, length(surn)-2); “VW begin . regCode := last3+id[7]+id[8]+idi9]; “ ShowMessage('File located !'); ¥ if chbAcc.Checked then ¥ ptnstats. Enabled: Strue; begin btnBudget.Enabled /:= true; v regCode := uppercase (regCode+'#'+provCode); ¥ en end else else begin begin ShowMessage('File cannot be located’); xegCode := uppercase” (regCode+'-'+provCode); ¥ end; end; end; redDisplay.Lines.add(xegCode) ; 222 | procedure TFormi.btnStatsClick (Sender: TObject); ptnRegCand.Enabled := true; end; var tfile :textfile; posAt :integer; prov, sProv,oneL,naam : string;
utbeq cr 4((%'L AdWeTANOTF /ISONIOF) ATISOLAOTH+, aste cs ST ys0D TeI0L,)ppy* seuTT*andqnopez pue #( (2/4 ‘Aowezang gy /S0Q90R) ETISOIISOT E+, A” #(,ipeyood ATIng, +6#+ (zy ‘Aovezangz3‘ [x] soqeyrIe) gz g90L300TT SF 4s0D UOTREpoMODDe ayL,) PY’ seuTT-gndanopez +6#+ ( [x] SMOOYTTe) TASOLAUI+ G44 [x] TeIoIze) ppy’ seuTT-AeTdstqpez ! * ((2*4*Aouezangzz /sogqns) gzySOLIWwoTa+, updeq L st 3s09 sous3sTsqns ouz,) ppy soupT’ Indynopez (A UeU3 0=[x] smooyzze JT L / ?4s0g09e+2s0NGns 4809202, uTbeq / #09Gx00" =: IsoQ00e Ss AOP 8 OL T =i K Z0x / {SéTxTedu =: ysooans / | CGHDIN Wid ELVA. +64+,SHOOW, +644, THLOH.) pp’ souTT-AeTdstqpez #zeeTO"Indynopez = f0ST=: ([z]lqeg*udexbereg-Aetdstapez uypbaq, Oo fos=: [T]qen-udeabeaea-Aetdstapex {TRA + 3809303/4s0900e ‘3s0Qqns ‘00T=: [olqen-udeabeaeg-Aetdstapez Tea Oo f€=! qunooge, udesbezea-Aetdstqpexz #(Qoelqo, :xepues) yOTTOISbpnguaq’ pwxCAL eztpeccad | ETT ° uTbeq oO fzebequr fpue Ww zea + ( (aozau) 23S0L3UI+, —_ #(Q09fqon :zepues) ¥OTTOZTUOIANG*Twaogy, eanpeosord | TZ ST ,+s07ds+, wory requ, )ppy°seuTI-4ndynopez ~ spus # ( (o0yU) F3gSOLIUT+, SG / ‘(peqezeued sentep,) ebessemnoys uoTzepomoooe Sutxzybez zequmy,) ppw: seupt-andjnopez ¢pue *(({squ) t3s0LIul+, seqebetTep Jo zequmN,) ppe*seutr-gndanopez A” 4{TT‘0) p~aSuegmopuey =: [TF] suooyrze # (@TT39) oTTASSOTO a ¢ upbeq ‘pus A OP 8 02 T =i T rox / * (Teu0+g #+A07d+64+weeU) ppy* souTT* andanopez = urbeq ypue fzeSequr iT Xx 7 4 (D0yM) OT [o) wea uTbeq c f(anelqoL :zepues) XOTTOTUOIIng’ Treg, exupesord | Tz'¢ LE ueqd .A.=Teuo FT ipue £ (aysod’T ‘Teuo) eqeTep + fpue pues /” £((F] 18208222) ppY’ susIT-T4ST Zz # (aozat) out me) uy6oq urbeq a) A” OP 8 Ol T =: TF soy usq} aozas = aoxd gt ra #Q=: TeI07 “Jd! (T-3¥s0d‘T/Tauc) kdoo =: aord TT {Q =: s6uTyoogu 4(Teuo’,Q,) sod =: yws0d fw} uTbsq ZI A 4£(qesod’T ‘Teuo) s1etap ro) fmebequr :r Afi (L-ased’/T/Teuo) Adoo =: weeu zea L #(Teuo’,9,) sod =: aysod c ?(q0efdog :zepues) eqeaTqOWMIOS TIO], exupesozd | ETE # (Tsqu) our A * (Te ‘OT TFA) UTPeTT = a “A ‘Teer : Te103 uTbeq A izebequt + sbutyoogu| TIE AOW (@TTIA) Joe you eTpyA fo) z A t(8TTFR) Qe80r a a” tzebeqt yo [g-*T]Aezze : ,suooyzze | Tre A” (4x3 seqeGeTep, ‘OTTI3) sTTEUsTSSy ¢ NOUSINO /” + [Xepurme;]-aozgoquo] smsqT-aczgoquo =!aoxas # (, NOLLYAOWODOW: +64+ 1 ZONTAOUE 1. +64+, SAWN, ) DPW" SeUTTandqnopez OG | ZNOLISING WLOL ans f0L =! (zlaea-ydexbezeg-qndynopex *pue f0ST=: [T] qe, ydezbexeg-qndanopex 108=: [0] QeL* yderbezeg* andanopex tpus fg =t qunooqey yderbereg * yndamopez A f90TZ =? STATSTA*QebpngTud , 4Q=3 aozqu uTbeq AFBI 00000% < 2809203 FT {
Downloaded from hlayiso.com yedDisplay. Lines. Add (axrHotel [x] +#9+IntToStx (arrRooms [x] )+#9+ FloatToStrF (arrRates[x],ffCurrency,7,2)); ¥ end; end; end; procedure TForml .ButtonéClick(Sendex: TObject); var maxR : real; maxH : strings I: Integer; begin maxR i= 0 if arrRates[i]>maxR Ythen begin arrRates[il; ¥ arrHotel[i]l; ¥ redDisplay.Lines.add('Highest Rate is ‘+FloatToStxF (mazR, ££Currency,7,2)+' charged by '+maxH); ¥ end; if (hotel=arrHotellil) “ and (arrRooms[{i]>=nRoom) Y then begin avail := true; ¥ redDisplay.Lines.Add('Booking can be made !'); pnlBooking.Visible := true: “ edtHotel.Text := hotel; im edtRate.Text := FloatToStr(arxRates[i]); edtRoom.Text:= IntToStx (nRoom) ; end; end; if avail = false then ¥ begin redDisplay.Lines.Add({'Insufficient rooms !'); end; end; 3.2.4 function TFormml.avgRates: real; ~ var sum : real; I: Integer; begin sum :=0; % for I := 1 to 8 dow begin sum := sumtarrRates[i]; “ end; result V:= sum/8; ¥ end; procedure TForml.Button5Click(Sender: TObject); begin redDisplay.Lines.Add('The average rate'+ FloatToStrF (avgRates,ffCurrency ,7,2)):” end: 3.2.6 procedure TForml.Button7Click (Sender: TObject); var nRkm,iPos : integer; aRt : real; begin nam := StrToInt(edtRoom.Text); mRt := StrfoFloat (edtRate.text); [ v ipos:= lstl.ItemIndext1l; ¥ arrRooms[iPos] := arrRooms[iPos]-nRm; ¥ mBookings := nBookings+nRm; ¥ total := total+(nRm*nRt*2); ¥V ShowMessage (‘Reservation has been made !'); palBooking.Visible:= false; end; 3.27 procedure TForml.Button6Click (Sender: Tobject)7 begin redDisplay.Lines.Add('Total bookings '#IntToStr(nBookings)); ¥ redDisplay.Lines.Add('Total cost ‘+PloatTostxF (total, ffCurrency,7,2)); ¥ end; SUB TOTAL QUESTION 3 48 3.25 procedure TForm].Button3Click (Sender: TObject) ; var hotel string; avail : boolean; rate : real; nRoom : integer; I: Integer; begin avail := false; hotel := 1lstl.Items[1stl.ItemIndex]; nRoom := StrToInt (InputBox('Data','Enter number rooms to book", "1")); ¥ for I := 1 to 8 do ¥ begin 10

Study this subject

More from Grade 11 Information Technology

View all