Skip to content

Information Technology Grade 11 P1 2016 Memo

MemorandumInformation TechnologyGrade 11201614 pages

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

Free to read online, no sign-up needed

Loading document…

Loading document…

KwaZulu Natal June 2016

Document textSearch extracted text and jump to a page.
Downloaded from hlayiso.com oe education Department: Edueation PROVINCE OF KWAZULU-NATAL JUNE EXAMINATION 2016 INFORMATION TECHNOLOGY GRADE 11 PAPER 1 EXAMINER: V. B. RAMKILAWAN (Stanger Secondary School) MODERATOR: R. PILLAY (Mountview Secondary School) MARKS: 150 DURATION: 3 HOURS INSTRUCTIONS AND INFORMATION: 4, This question paper is divided into THREE questions. Answer ALL THREE questions. 2 This paper is set in programming terms that are specific to the Delphi Programming Language (utilizing the IDE Embarcadero Delphi 2010 or later), 3. Make sure that you answer the questions according to the specifications that are given in each question. Marks will only be awarded according to the set requirements. 4, Answer only what is asked in each question. For example, if the question does not ask for data validation, then no marks will be awarded for data validation. 5. Your programs must be coded in such a way that they will work with any data and not just the sample data supplied or any data extracts that appear in the question paper. 6. Routines such as search, average and selection must be developed from first principles. You may not use the built-in features of a programming language for any of these routines. 7. You must save your work regularly (at least ance every 5 minutes) on the disk you have been given, or the disk space allocated to you for this examination. 8. Make sure that your name appears as a comment in every program that you code as well as on every event indicated. 9. At the end of this examination session, you must hand in a disk/CD/DVD/flash disk with all your work saved on it OR you must make sure that all your work has been saved on the disk space allocated to you for this examination session. Ensure that all files can be read. DATA FILES 10. Three GUI Forms have been provided. You are not allowed to modify the GUI, text-files or any pre-defined procedures / declarations in any way. 41. Ensure that the data folder named “June_Exam2016” is on your Desktop. 12. Inside this folder are THREE subfolders: Question1, Question2 and Question3. 13. Inside each folder is a Delphi Project File (SKB in size). The files are: q1_p.dproj (for Question 1 — found in the Question1 folder) q2_p.dproj (for Question 2 — found in the Question2 folder) q3_p.dproj (for Question 3 - found in the Question3 folder) 14. Question 1 has a text file named “INGREDIENTS.TXT” (in the QUESTION1 folder). 15. Ensure that ALL data files are present before beginning the examination. THIS QUESTION PAPER CONSISTS OF 8 PRINTED PAGES. 1
S £ 1 . + ects Iavarmw oe) cy voce TATE TEA TOIT SUTtt SCENARIO The Cooler Cola Company is one of the world’s largest producers of soft drinks. These refreshing fizzy drinks are immensely popular, especially during summer. Cooler’s range of drinks are very diverse, ranging from its traditional Cola to the fruit-flavoured drink called “Santa” and the lemonade-flavoured drink “Frite”. As part of the software development team at Cooler Cola you have been tasked with developing “portals” which will assist them in the daily running of the company. QUESTION 1 Customer Portal Customers are a very important component in the success of a business. Cooler Cola requires a “Customer Portal” which will help manage the most common tasks involving customers. 1.1. User Code Generator ( Write code for bfnQ1_1 which will generate a unique user code. va Obtain the Buyer Type from the ComboBox (embBuyerType). Buyers at Cooler Cola can fall into 1 of 3 categories: e Distributor e Wholesaler « Customer Obtain the Buyer’s Name from the Edit Box (edtBuyerName). Generate and store a random positive two-digit number. Generate a unique code for the buyer by combining: e the first three characters of the buyer type with e the random two-digit number and e the last letter of the buyer's name. 4.1-User Code Generator vv wv Buyer Type: DISTRIBUTOR ~: . Generate. Generated Code; DIS94H /- > -—- Display the generated code in the Edit Box-ediGenCode.---— - - ——- —— [15] Buyer Namet “RERITH i {
Downloaded from hlayiso.com 1.2 Transaction Interface Each user purchases “credits” in order to buy products from Cooler Cola. These credits can be redeemed for different products. Products are priced as follows: PRODUCT PRICE Crate of 12 (1.25 Litre) 101.25 Pack of 6 (1 Litre) 35.88 Pack of 4 (2 Litre) 45.25 Pack of 4 (2.25 Litre) 53,81 > Obtain the amount of credit available.as an Integer from spinner sedCredit. > Obtain the product which the user wishes to buy from the List Box (IstProductsQ1_ 2). > Determine the quantity of the selected product that the user qualifies for by using the credit available and its respective price. > Calculate the user’s remaining credit. For example: if the user has 1000 credits, and wishes to purchase “Crate of 12 (1.25 Litre)”, he will qualify for 9 crates (Total Value: 101.25 x 9 = 911.25) and his Remaining Credit would be 88.75 (1000 — 911.25 = 88.75), 1.2 - Transaction Interface 1.2 - Transaction Interface Credit Available: 09° ~C~C~C”~CS = Credit Available: iso ~”S~*~*~S s Select a product category:|fgieiaiy fae Nel Select a product category:(Crate of 12 (1.25 Litre) Pack of 6 (1 Litre) Pack of 6 (1 Litre) Pack of 4 (2 Litre} Rac Pack of 4 (2.25 Litre) Ttems you qualify for: 5 Items you qualify for: Remaining Credit: 88,75 ee Remaining Credit: > Display the number of items that the buyer qualifies for in the Edit Box (edtltems Qualify). > Display the amount of credit remaining in the Edit Box edtCredRemaining after the buyer has completed the transaction. [15]
pala > Pron tret [arm aas <7 imomv aS ee Po otrt rN LI 1.3. Social Responsibility Discount Calculator The Cooler Cola company’s Social Responsibility Policy promotes assistance to sellers who service poorer areas. Discounts are calculated as follows: CUSTOMER DISCOUNT % None ie] Urban School 5 Rural School 10 Rural Shop 7 Informal Trader 6 > Obtain the Transaction Amount entered by the user from spinner sedTransAmount. > Obtain the Discount Category from the Radio Group (rgpDiscQ1_3). > Write code to: * determine the Discount Amount. » determine the Final Amount. (Example of Discount and Final Amount shown in the screenshots below.) 1,3 - Social Responsibility Discount Calculator 1,3 - Social Responsibility Discount Calculator ee ary Transaction amounts 1900 a Transaction Amounts 725 be) Discount Category = Disccunt: iscount Category — Discounts O More RSc.oU Mone R50.75 | i@ Urban School Urban School ! ©) Rural School Final Price: ©) Rural School Final Price: | eo Rural Shop: RS0,00 @ Rural Shop R 674,25 ©) Informal Trader | sy Informal Trader | | Poy - » Display the discount and the final price, in currency format, with TWO decimal places, in the respective edit boxes edtDiscount and edtFinalPrice {15] 1.4 Ingredient Description One of the most commonly asked questions by customers is what the various ingredients used in making Cooler Cola products do. The company’s Food Technology department has captured the most important ingredients in a text file named “ingredients.txt” (found in the Question! folder). It is formatted as follows: NAME OF INGREDIENT#DESCRIPTION OF INGREDIENT EXAMPLE: ~ --.~ SaccharinitSaccharin-is-a calorie-free sweetener. (# acts as a delimiter)
_ Downloaded from hlayiso.com Write code to do the following: Check whether the text file “ingredients. txt’ exists. Display a suitable message (using a message box) if the text file does not exist and close the program, ° Do the following if the text file exists: * Obtain the name of the ingredient from the Combo Box (cmbingredQ1_4) provided. « Use a conditional loop and search the text file for the ingredient obtained from the Combo Box. ; « When the name of the ingredient is found, display the description of the ingredient in the memo box (memOutput) provided. 1.4 - Ingredient Description 1.4- Ingredient Description ; Ingredient: Pantothenic Acid + Ingredient: EDTA ¥ Pantothenic Acid Is also called Vitamin BS. “EDTA stands for Ethylene Diamine Tetra Acetic - acid and is used as a preservative, [15} SUB-TOTAL: 60 QUESTION 2 Sales Portal The Sales Portal is used by the company’s internal planning department to project possible sales of their various products in the month ahead. Sales are expressed in 100000s sold. An array (arrProducts) has been pre-declared with the company’s 7 best-selling products: ‘Cooler Cola’, ‘Santa’, 'Frite’, 'Cool Zero’, 'Frite Zero’, ‘Steel Brew’, ‘Santa Apple’. A second array (arrSales) has also been declared; although no values have been assigned to it. IMPORTANT: arrProducts and arrSales are parallel arrays. ) 2.4.4. Write code for the Generate button (btnGenerate2_1_1) which will: Fill Array arrSales with random values in the range 0 to 99. (3) 2.1.2 Write code for the Display button (btnDisplay2_1_2) which will: Display (in neat columns and with suitable headings), the name of each product from arrProducts and the corresponding value from arrSales in the Rich Edit Box (redOutpuf). (8) N.B.: As sales are randomly generated, your output will not necessarily match the screenshot below. Product Sales | {Cooler Cola a0 } iSanta 85 ' 'Frite 38 iCool Zero 30 Frite Zero 46 : Steel Brew 8a i ‘Santa Apple a3 :
my is t ata Ooctet Voss .— t 2.2 —.~ |[Santa —~ — oe es | Steel Brew ee 0 Once sales have been randomly generated, various processing tasks are required. N.B.: As sales are randomly generated, your output will not necessarily match the screenshots below. 2.2.4 When button Highest Sales (btnMaxSales2_2_1) is clicked: Determine which product had the highest sales and display the product name in Edit Box edtHighest. (10) “Highest Sales | SteelBrew 2.2.2 When button Search (btnSearch2_2_2) is clicked: Use an InputBox to prompt the user to enter a name. Enter Item to Search for | ‘Frite | LOK - Cancel Cooler Cola Produ Write code to find the sales for the product entered by the user and display the sales value in the Edit Box edtSearch. (Uaee eterna If the user types in a search query for a product which does not exist, display "Product Not Found!” in the Edit Box edtSearch. wits Search ] Product Not Found! — (12) 2.2.3 When button Average Sales (btnAveSales2_2_3) is clicked: Write code to first determine the total sales; and then the average sales. Round the average and display the value in the Edit Box edtAverage. (10) ¢ _ Average Sales | 56 2.2.4 When button ‘Products with Above Average Sales’ (ptnAboveAve2_2_4) is clicked: Determine which products have sales above the average sales (calculated in 2.2.3) and add the product name(s) to the Memo Box (memAbvAve). (7) i sete Products waith above-average sales: : | Santa Apple SUB-TOTAL: 50
Downloaded from hlayiso.com QUESTION 3 Production Portal Cooler Cola sells its products in smaller quantities for people “on the go". These are produced in the following quantities: ¢ 330ml cans ¢ 330m! plastic bottles + 500m! plastic bottles. ¢ Each can requires one clip (used to seal the can). ¢ Each bottle requires one cap (used to close the bottle). e The cap size for the 330ml bottles and the 500ml bottles are the same. NOTE: Code for 3.1 to 3.4 is written for the PROCESS button (btnProcess). 500m! 330ml 330ml “p-4 Extract the data from the spinners (sedCaps and sedClips) in order to determine how many Caps and Clips are available. (2) 3.2 Based on demand, Cooler Cola produces twice as many 330ml plastic bottles compared to 500m! bottles. For example: If there are 30 caps available, they will produce: 20 x 330m bottles 10 x 500m! bottles NOTE: Since 330m! bottles are more popular, if the available caps cannot be exactly distributed between the different bottle sizes in the given ratio, then the extra bottle(s) produced MUST BE of the 330ml capacity. Write code to determine and display how many: > cans will be produced (based on number of clips available). (2 > 330ml bottles will be produced (based on number of caps available), (7) > 500ml bottles will be produced (based on the number of caps available). (7)
7 » DOWROEeeo-FFror Haytse-con all dnl Trt v s<T weet 33 Cans: 35 Cans: 24 . egy | [330ml Bottles: 40 spo gy | [580ml Bottles: 18 Capa: 53 | |sooml Bottles: 19 Capst a7 | |soomlaottles: 9 Coo ler Clips: 3 a Clips: ns] Col : a sells cans in packs of 6’s. > Write code to determine how many complete packs of 6 will be produced using the result of cans calculated in 3.2 above. (6) > Determine and display the number of surplus cans. (5) NOTE: Surplus cans are those left over after full packs of 6’s have been bundled. For example if there are 35 clips, the surplus will be 5. 30 cans will be placed into 5 packs of 6’s; leaving 5 behind as a surplus. Cans; 35 cone fo ce : =o er: | [s30ml Bottles: 16 Caps: 59 a 35th Bottes: o Caps: a7 a 500ml bottles 9 No of 6 Fackst 5 No of 6 Packs: 4 a Surplus: 5 | Surplus: 0 Clips: 35 ie Clips: 24 Ba 3.4 Write code to enable the Save button (btnSaveQ3_4). (1) 3.5 Write code for the Save button (binSaveQ3_4) to: > Create a new Text File named “ORDER.TXT”. (3) > Write the information from the Rich Edit Box (redOutput) to the Text File. (6) > Display the message “Data saved” using a Message Dialogue Box. (1) q3_p Data Saved SUB-TOTAL: 40 GRAND TOTAL: 150
(gi) TL 4$0 7 a8eg i ‘pz'g‘houeungy' . y aOR ORES) “HSC HPO = P2120 hone a OOSIG) ALISO [120}.4 =: [EU PS Sb 09 S1VLOL" “unos = (Xe Junoosiqips ans . SIC p- JUNO) =: jeul4I 7 - WSWS}ZIS eI % a , PXOGOWS OF ke 115°S01D f ‘pua pefeds: $0 »Junowlys =: Junoosiqu : » 7 (S)algeuen mau ul peiois pue A Se} 031100 UA rice pailog . g DA ae * nouns = Junoosiqu : ¢ pall MeL won uo paseq yds s} en bee i a wu OLY =: JUNCOSIqU : Z 6 7 pasn Apenoo (ou erep Ades oy uoware}s ese a Zyunowiys =: junoosiqy | 1 t NURS OR YA qUOUIDIeIS SIA Alo L (/DUISSEO0I / ques ; S 9918S! -ese0 = aieu By waLi0o d 20) XOGoqUIOD WOH WSy SEIS TSH q . ‘0 =: JunOOsiqU 7 pureiboid dols pue x Spee ou 9} OF SUL OF TU: “ai Papers ueIGO _ " aw Aejdsy T REIS OI suBIS: 7 xepujway¢ idsIp US = -}SIXe ISS Conte LOISIqdB! =: joa pre 1 SPP Oly BA g 7 ‘anjepunowysues pes =: no er 3 palepap Siqeuen = | utBeq Zz 7 KOUSiIA ! La pecs: / UeBequy 39912 SuaiInd Se PaweULIOY Axo: : s (st) / yey : Puls Qunounys munoosig 72 feUung Se PayEWIES~ “og Te See SPSS Sk. ‘ - bs HI i JUNOISK — | mei @pelg0.1 sepuss)yHDe~ LOosiad6 gen RUBY Woy » juNoDSIC 6 a seresid g 1061 L041 sinpsooid 19 Bunsenans fq poremores sunday Jeu ‘ Z jeuls A(Z'e'paxiayupas * D4) INSOLE ‘pus t fe {(1e20. 3e0|4 =: xe | Bururewe L 7 WS | XSpUl Pal YH PAL ees uaue » / 1) “pai = Upaiou : idS WO juNOUNY UOHDesueI, Susie (> XSpUlWueNZ-1DSIONpOsS 2 BIS! b Z uonesepd e1qeuen < = P SRIEAUpeipes =: - pans z : — _ [cet Hl PS . B04 XG D3 0110) Domne ea SH SNGINO ROY 2 TIO uperai £ “AUIDEI (BIO) WO» Boenae Jequinn sindiag ; “(Lees ‘oz'Gp ‘99° seBeqy] :oa}egt Doe ee ee tie SaIBS | €6 ‘Sz’Sr ‘ag'se oz" Inojeo ypsio Buruye GZ LOL) = 1e8y Jo feo} Aeniy : JeA A/ poy ayo Aue A SIGELEN E OF PAL eet {s ‘08! IV: S30 due 20 HOOTS ‘AIG Bulsn pu peubissy So i) $Q0@!GO 1 epuag)yoDz~ ISM» UMOG PepUNoY MOOS LOSIONPOLgAS|"| UOJ aun ysuoo s “»pasn soqesedo uolsiAiq peooid z essg tbh Samed 1080 susy 1 pesn oid jau199 E (7 Bulssa00id JO) XOg 1S] Woy ag Joa saqeyngpea / dayeT se} / fepoguesps =: . ‘pus 7 buissao + “A PSWaIes Ue] i a ‘fouen moana mgpueal soul + ean Soousoipe 5 oid) Suds WH eIeD UETIO oo ‘ovebueyus ae “ailswenvongs = PRoTSop oe ib AUoTeIe|SC SIGeueA, lOpuey =) WNNWOpUeYT “oneuratey ae “owens) ~Adoo apyerannd f 4 a | SAE UY 1/4 ‘0 L-+(06)wopue: =i, Joye ysey ‘/ -X0@ Hp UI | 1 A c Y =: LUNN! y a UP3 Ul ABPOo payeioueb u ete 7) aKOL SI pueyi 7 apoo [euy aye. 8B skeidsi (re ‘4 L'4 [eciougiiswayedé efingau) tae Pe =! - OWENS z ZBUSSSO0Td 28) 7 sue Sang = aS aieer eure 5 i 9 =! 9 “abi / SOB] ISE| ! / Xepujwey)"edk Liekngquis aan € = Fue Ea uy Jequina Siar sl Pes | . = SO1OUS! L 7 SiaweIeyD eA Ul S5I0}S PUB ABUT ueBexuy : eo10yo) * ujBeq > XSpul — Jsuy soidoo pue WaodS wea Spe1yS) ‘sung: OUD! wANwOpLEE i paloeles Sassooosd pue 104g WHY SOE JayeT Se] ‘eweNs ‘epo: D1esys XVIN xogoquog Woy ejep spesy ‘@o8M901 39 ° PUES HONOL™ LOUWG™ Jen SNOLLN i rE "NO OUI LUO einpecoid 10S aTaISSOd GNV SANG } NOWLSAND ILATIOS S1GISSOd — K 1} UadVd ‘bE 3avua IND ONDRIVIN SO TONH: i i OL NOLLVINN "see 9L0z IOANI n=Von NOILVNIWVXa ANN? a, 03 40 LNSWIaVdad WL VN MINZVMy
procedure TForm1.cmbingredQ1_4Change(Sender: TObject): var singr, sLine : String; t: TextFile; sSplit : TStrings; begin if not FileExists(ingredients.b’) then “ begin ShowMessage(File does not exist. Program will terminate’); ~ Application.MainForm.Ciose; “ end; AssignFile(t, ‘ingredients.bxt'); ¥ reset(i); ~ singr = embingredQ1_4.ltems[cmbIngredQ1_4.Itemindex}; v while not eof(t) do ~ begin ReadLn(t, sLine} ¥ sSplit = TStringList Create; ExtractStringsY ([#] “.], PChar(sLine), sSplit); ~ if sSplitf0}=singr then” beg memOutput text := sSpiit{1]}; “ end; end; closeFile(t); “ end; TOUT IC A-FAIM yor AX PTrorre rire far SUB-TOTAL: 60 ca ) (15) QUESTIONTWo \_? 2.1.1 | Populate Array For loop’ with index counter 2.1.2 | Display Paratlel Arrays in neat Columns I Sets Tabs; or uses another method to setup tabulationvY Headings tabbed ” i Counter variable” for Display loop “ I Name of Product displayed first” : Corresponding Sales Array element displayed after tab” 2.2.1 | Find Highest Variable Declaration for counter and max “tracker” “ i : Assumption that first or last item is highest” ! Position of highest assumption stored” For loop “with correct range (2 to 7 or 6 downTo Ivy ' If... statement to check if test Array element is higher” | Stores new high value if found” Stores new high position if found” : Display to correct Edit Box, “ the element from ArProducts. “ 2.2.2 | Search H Variable declaration v | Obiains search item “from user via.an Input Box. “ Flag for success of search is initialized. v i For loop with correct range” : If statement to compare search query with elements from anProducts” Displays found item “to Edit Box” Changes flag value if found / not found ~ 12 Whroage N UYU 2.4 | Average Variable Declaration ¥ Sum variable initialized-to 0. “ For Loop “with correct range. “ Sum variable is changed by adding elements from the Array. Average is calculated by dividing the sum “ by the number of items. ¥ Average is displayed” to Edit Box. ” i i | Evaluates flag “and displays message¥ to Edit Box if not found. ” | | i ! i if 70 25 | Above Average For Loop ~ with correct range” If statement” to test for element > than AverageW Element from ArrRange” is added v‘to the MemoBox. ” fl SUB-TOTAL: 50 | Page 3 of 11 Page 4 of 11
TL Jo 9 a8eg (OL) ayiso.cam from An gade Do 7 G30} YOURE O} WEY J9]UZ,"sIONPoIg B}OD J91009,)xoginduj =: A YoIeags ‘Qoelqo.L yepuas)yoOp "Zz zeayenoqyurg’|wuo4) ainpaooid ‘pua / (eay)ngo py] =, prey aBersayipa ‘(AL A/ wing!) punol =: any! ‘pua 7 ililsepegue‘wng!) pour uiBeq POP LOPES! - 1 soy 7-0 = wnst ulBaq / Je6ayuy 21 ‘wng! JeA ‘Qoaldo.L sepues)yog|e z zselegenyulg' LWu04! ainpasoid ‘pus ‘pua 7 siPUNOY JON JONPold, =!» Ke | "Yueagipa ulbeq UU) OS]2} = PUNO J ‘pus ‘pu A ‘8nd =! pune q 7 (lisaesue)ago uy =! xe Lyoreagips ulbaq ual [sjonpoigue = yoreess jt ulbeq, POP ZO} | =! 1 JOY 7 ‘asjey =! puno4q TIO g aBeg ag: “ i SWLOLens (or) Z dsogubipijobueyue =: pre) Sebi pe () ‘ os _ pus | tpue eee Als! SOgUBIHI 7 (hjebueyue) ~ppysoury» anyaqyweu 2 Users =: ieee ulbeq 61 i sores ueyt s3yBiH! < Useyegue oa ulGaq OP 2 OFZ =: 110) POP LOVE =2A 140} ° Poe bob ! ulBaq 4 ae eben 7 ‘[Lseregue =; sey dea A” “eBay : seus Jen ‘Q09f901 sepueg)ionO LZ zselegxeyuig: LWwWO4) ainpsooid (g) {pua ‘pua ‘Cy (Useesue)aso yup es+ » [sionpoigure)ppyseurpindingpas | uibsq POP LO} L =: 140} {(s==.+6#+,.=====,)ppy seurtndinopa: 7 ‘Use1eS.+-6#+ JoNPOd,)ppy' seul} yndinopas ‘pua 7-00) = [p]qe1 7 2001 = folaey 'Z =! yunogge | uiBeq op ydeiBeseg jndinopa; yum ‘ueaig’ssurtndinopes ;_ ulbeq ‘seBoquy 21 JEA ‘Q20MgO 1 sepues)yoOZ™ 1 zhe\dsiquig Luo) eunpeooid {e) i ‘pus | ipue 7 “(ooLwopuey =:, [i]sepegue | uiBeq Pf OP LOL = 140} | ut6eq ulSaq | ‘ea *uesjoog : puno4q iqoak uepue: ar - - aBaquy 1 uareseI Goelqo 1 sepues)oO LL TaPeISUIOUIG | UUO | sunpsooid ‘Buus : ‘HeeSs seBaqyy : any! ‘sogmoqt ‘soquBipy) ‘Q08fgO.L uepuas)yo} IOZ % cydea~g"| WIO4] ainpaoold y “en i. oO NOILLN10S F1gIssod
QUESTION 3 ed Note: Question 3 is designed to be a “problem solving’ type question. Therefore learners may approach this question in a variety of different ways. Consider the learners solution steps and if they are sensible, allocate marks at your discretion. tra Extracts data from spinners and stores values in variables. ~v" [ (3.2 Either equates cans value fo clips and displays it; or simply displays the number of clips as the number of cans W” VT Determines the number of 330m! bottles to be produced. Code should be written to calculate~ the 330m botties produced to be doublev’“ the number of 500ml bottles produced, {2:1 ratio). Should the | value retum with a fraction, it should be rounded up. “ Final Value displayed. ” Determines the number of 500mi bottles to be produced. Should be half the number of 330ml botties. “If the ratio is uneven”, will be one less than half. Number should be rounded down, if decimal value is present.” Final Value displayed. ” Depending on the learner's method, a check may be necessary to see that the 336mi bottles + 500mi = number of caps. If not, the number of 330mI bottles could be increased by the difference, Vv ¥ 3.3 - Number of clips“ are divided by 6”, floor rounded” and stored in a variable. ~ Answer is displayed to Rich Edit Box~” with suitable caption. Remainder is caiculated ~ after dividing number of clips by 6. ~ Answer is displayed in Rich Edit Box’ with suitable caption. [3a Save button is enabled. ~ 3.5 Text File variable is declared” AssignFilev” statement with correct file name” Rewrite statement Data is copied from Rich Edit Box “for processing. ~ Data is writfeny’ to text file. ” File is closed. ~ ShowMessage statement with suitable message. SUB-TOTAL: 40 POSSIBLE SOLUTION: | procedure TForm1 btnProcessClick(Sender: TObject); i var i iCaps, iClips, iNoCans, iNoSmaliBot, iNoBigBot, iDiff, iNo6Pack! i6PackSur : Integer; begin ! redOutput.Lines.Clear, iCaps := sedCaps. Value; ~ iClips -= sedClips. Value; ~ iNoCans := iClips; ¥ i iNoSmallBot “:= ceil” (iCaps / 100% * 66~); ! iNoBigBot “ := floor’ (iCaps / 100 * 33”); H | i | t | / | | 1 | \ i IDiff -= iCaps - (iNoSmailBot + iNoBigBot); ~ if iDifF > O then” begin iNoSmallBot = ¥ iNoSmaliBot + iDiff; “ end; tedOutput Lines.Add(‘Cans: '+IntToStr(iNoCans)); ~ i redOutput.Lines_Add ('330m! Bottles: ‘+IntToStr (iNoSmalBot)); v redOutput.Lines.Add (‘500m Bottles: 'HntToStr (iNoBigBot)); ~ ' iNo6Pack v= floor’ (iNoCans¥ /6); ~ #/ Alternative: round((i i6PackSur v:= iNoCans “mod 6; “ redOuiput.Lines.Add~’ (No of 6 Packs: ‘+InfToStr(iNo6Pack)); ” ! redOutput Lines.Add~ (‘Surplus: ‘+IntToStr(i6PackSur)); ~ H 4 joCans /6)-0.5); | binSaveQ3_4.Enabled := true; “ (30) end; procedure TForm1.binSaveQ3_4Click(Sender. TObject); var t: TextFile; ” s : String; : begin ; i AssignFilev (t, ‘order.txt); ” Rewrite(t); ~ $:= VredOutput. Text, ~ ' WriteLn (t, s); ¥ : closefite(t); ShowMessage('Data Saved’); ¥ i end; I SUB-TOTAL: 40 ! | GRAND TOTAL: 150 Page 7 of 12 Page 8 of 11
TE 50 OT aSeq TT 40 6 a3eq ! Downloaded fram hlayiso.com wg ‘(aSIxe Jou ss0p ols, ebessayymoysg ydsoxe ‘Q)aisesoig ipue ‘pus (uonduosegs)ppy seurndingoww ‘end =: puno4q uibaq USU} PUIIS = JUSIpasBuys 9) ‘eur7s)Adoo =: uogduosags +() - xepuyl ‘| ‘eurs)Adoo =: usipesBuls ‘euns '#,)sog =: xepult ‘(ours Vujpeay ulBaq op (ese) = puno4q) ANY (()403 LON) a1um dee|o’seur7indingowtw ‘8S]2j =! puno4g ‘Ghesey ‘epulweyyLopeiBujquojsweyyLOpeiBu|quio =: puiys Pa siusipei6u, yer4yubissy Aq uiBeq ‘uesjooq :puno4q SeBenu] xepuyt ‘Bus :purys ‘uopduosaqs ‘qualpei6ujs ‘eurys ‘sBXeL 3 Jen “QelqoL uepuss)ebueyop LopeiBujquuo” LUHO4| sinpsso1d wh “SNOLLM10S SALLYNYALIV a. ( AnpenQou)agopuy =: xe, *(@ouds « Aytendou) - spars =: supain6i LUBY) (eouds / SUPSIOJOOY- YE] =: ApjentDou i ipus SLES =! SOU ¢ 40 Xepull aseo xepujwey'Z LOs}onpols) =: xepul! ‘On[eA Upaiguds IPHDI ulBaq ‘Bung onpoigs yPaOSururewsyy ‘sypaigu ‘souqs ‘eBay -AyjenQou ‘xepujl : Jen ‘petaoL uepuss)oNOz LOSIoNpolgisy } W041 ainpesoid cL “SNOILMOS SALLYNYSL I
ALTERNATIVE SOLUTIONS: 31-34 procedure TForm1.binProcessClick(Sender. TObject); var . iCaps, iClips, immi330, immi500, iNoOf6packs, iSurplus: Integer; 4 Type your code here: begin 3A redOutput Lines. Cle: i. iCaps : i iClips := sedClips.Value; 732 D imm330 := cei ps / 3) * 2; i) immi500 := floor(iCaps / 3); f-. redOutput.Lines.Add(‘Cans: ' + IntToStr(iClips)); >) redOutput. Lines.Add('330 ml bottles: ' + IntToStrfiramt330}}; nM redOutput. Lines.Add('500 ml bottles: ‘+ IntToStr(imm|500)); of 13.3 N34 btnSaveQ3_4.Enabled := true; end; Downrod oe Page Hof 11

Study this subject

More from Grade 11 Information Technology

View all