Skip to main content
Open navigation menu
Close suggestions
Search
Search
en
Change Language, English
Upload
Sign in
Sign in
0 ratings
0% found this document useful (0 votes)
215 views
266 pages
Simple Logic Programming Formulation
Study Flow Chart
Uploaded by
JohnLeonardTernida
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Save
0%
0%
Share
Report
0 ratings
0% found this document useful (0 votes)
215 views
266 pages
Simple Logic Programming Formulation
Study Flow Chart
Uploaded by
JohnLeonardTernida
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Save
0%
0%
Share
Report
Page view
Download
ES ee PHIL. COPYRIGHT 2008 Sy: Andes Mountain Printers Printed May, 2004 SIMPLE PROGRAM & LOGIC FORMULATION ISBN 971-8523-24-3 eS ij “Sy ALL RIGHTS RESERVED NO PORTION OF THIS BOOK MAY BE COPIED, REPRODUCED IN BOOKS, OR PAMPHLETS WHETHER PRINTED, MIMEOGRAPHED, TYPE- WRITTEN, XEROXED OR IN ANY OTHER FORM OF DISTRIBUTION OR SALE, WITHOUT THE WRITTEN PERMISSION OF THE AUTHOR. Edited by: Juvy Basbas De La Rosa Published & Distributed by: Andes Mountain Printers #25 I. Francisco St., Malinta, Valenzuela City Tel. # (02) 291-0313 Fax # (02) 291-0303 Cell # 0915-3759455 3= To my wife Juvy Basbas De La Rosa and our angels Jecelie Claire and Julian Pauline oeACKNOWLEDGMENT My sincerest gratitade to all the people who served as slaty in the fulfillment of this writing Sheryl Basbas, Jam Cadainggan, Jon Gaddy, Antonio Dungea, Rommel Espinosa, Erwin Mendoza, Alan Pacion, Alvin © Limpin, Harvey H. Sadiaca, Elmer G. Cruz, Reggie Exposa, Benjamin Santillan, Piel Javier, Dennis: Reyes, Jim Pangan, Glenn Gutay, Armold Alcodis, Mike Gerard Galon, Rundy Aguas, Alan Aguas, Eric Ambrocio, Dino ‘Quintans, Anne Mane Tongson, Cholet Ballesteros, Abel Reyes, Terence CGuanio, Susan Guania, Ryan Brozo, AB Arias, C) Aguirre, Vher Agbay, Ofed Ousilla, Cecile Lopez. 10 Nadora, Members of The Fisherman's Antiphon, Prends from Silliman University, Marexans, and Tony Andes Sr. for all the inputs, support, and encouragement. Bolet P. Calleja for his 64-bit worth of wisdom, comtineoas guidance, and untelfich sharing of knowledge. My Master in Information Management students, o realization of Tacit to Explici Knowledge transformation. My family, Jun, Arceli, Mama Cita, Jacel, Jeffrey, Susan, Rene, Venus, Vener, Marci, Joy, Agnes and Romnie for all the inspirutions. Above all, to our GOD ALMIGHTY for all the blessings To God be the glory!!!JERALD HERRERA DE LA ROSA Hic iso certified! 80 90012000 — Quality Management S94 n Auditor, ISO S200 — Quality M. 0 Systems for Software Organization Awditor, and the } Lope Excellence Awanl (HEA) Assessor using the Haropean Foundation & Quality Management (EPOM) Model He received his Bachelor of Science in Computer eno degree and Master in Business Management from Saint Francis of ‘College System, Master of Arts in Extension Administration from th Silliman University 2s CHED-PAPE scholar, and Masier in leformoedio Management from Asia Pacific College He was the former Asiistant Director of the | Vice-President for N.C.R. of the Philippine Instinte of (Comp Engineers (PhICEs) for several years, ] At present, he bolls ihe followi Hie! Management Director at Global Idealopy “Corson es ant at the European Chamber of Commerce of th Cae Che eas, Meupement Prof seagreciee College Graduate School o Crmaation hf PC Computer Science and Se eeeCHAPTER 1 CHAPTER 2 CHAPTER 3 (CHAPTER 4 CHAPTER 5 (CHAPTER 6 CHAPTER? CHAPTER 8 CHAPTERS TABLE OF CONTENTS Introduction, Basic Symbols and Variables Working with Process Symbol jeoeewen and Process Decision Application Loops and ltaration Switch Functions Arrays Working with Arrays & & & 48 111 141 199CHAPTER 1 Introduction, | Basic Symbols and VariablesIn this. lnowledge em, on: cannot live wiihout technology. 1 fealty Tot technology is now-a way of life, It is a ificant component of our daily existence. It has revohstionized vay Of doing things — household chores, bosiness,. leisure, pmunecation, travel, amd all ith wherin push-button Me electromc cowipment is present. Have we about the things that made these techaologies'’ Howe we er asked what were itv fonm, jook, and fonmat before if was allied -choology? This curiosaty weld jead os to the world of “behinal the scene” ‘This “behind the scene” is daven by 2 COMPUTER RAM to implement action and procosses that are happening i technology response takes place. Just like wetching 2 We know that when we switch the igniter on, a Mlame bumer, but have we ever thought of understanding the » that takes place in lighting the gas stove? What abot the. behavior anc format of the source where the flame came ? Let's look at the “behind the scene” proces: of the gas-stove mple. When the igniter of the gzs-stove is switched on, the gas gece ool of the unk: the gas flows through the rubber pips and goes directly to the barnes; it passes through an electronic igniter and produces the flame. f This: “behind the sccm: Simdents understanding of the technologies are providing. Ir procures on bow theses techs the students in the different cy of Coomputer Programming from the resources used for processing, how it ic processed, when if is to be processed, the owlput of ihe propes:, and the figel thor drives the process focus of this book, the and’ processes thea me the stop-by-siop reality. Ut will assist This book will alse poide studenia to appreciaic the Analysis side of programming. This will also facilriate to the Muibers the simplest way ol appreciating and learning the “behind the scene” of technology To grasp knowledge of "behiew! the seene”, this hook will eo ton called: “fhewchartiti!) White ‘bisal” Wall help beginmicrs*7 ef coving. hig jake-cf b . = 7 h a) and cay a nit t : a aeationn ot the woy and eins with “STARTS 9 journey, se ag cing Us Oo the, Compater Sysem ‘or Wihen wo are the first. instinct thal comets ed as to ee aE c When we have the calculator, there are (hings. thal we think and do insamtancously. “The fire resgetice 1 automatic. We 1 i j analyze the objective by identifyung the mathemalical operating needed (edition, = subtraction, muiliplicaleon, civiseia, exponentiation, tc.) thes, we imput the data to be computed by pressing the barton that repeesents the. mumbers i mathemarcal operations, we then press the equal sign baton precess the inputted. manibere The result is then shown one display panel of the cabealator: ibis result whether comec © emronedus is What we call onipul given an obpective 0 compuille large munibers, te oar The relationship of the input, process, and @ components producing the result doesn't stop there, The outpull we on our cabculsior can be two things, first is the inconreet and second is the correct result We pet incorrect newalt, wire: y y input wrong data by pressing either the wrong vedor by pressing wrong mathematical operas beading to either negauve value or error result. ¥ Lz7 ef coving. hig jake-cf b . = 7 h a) and cay a nit t : a aeationn ot the woy and eins with “STARTS 9 journey, se ag cing Us Oo the, Compater Sysem ‘or Wihen wo are the first. instinct thal comets ed as to ee aE c When we have the calculator, there are (hings. thal we think and do insamtancously. “The fire resgetice 1 automatic. We 1 i j analyze the objective by identifyung the mathemalical operating needed (edition, = subtraction, muiliplicaleon, civiseia, exponentiation, tc.) thes, we imput the data to be computed by pressing the barton that repeesents the. mumbers i mathemarcal operations, we then press the equal sign baton precess the inputted. manibere The result is then shown one display panel of the cabealator: ibis result whether comec © emronedus is What we call onipul given an obpective 0 compuille large munibers, te oar The relationship of the input, process, and @ components producing the result doesn't stop there, The outpull we on our cabculsior can be two things, first is the inconreet and second is the correct result We pet incorrect newalt, wire: y y input wrong data by pressing either the wrong vedor by pressing wrong mathematical operas beading to either negauve value or error result. ¥ LzWe get comect reeeli from oar caloubation TASfinct Somes into our mind: we either use the reall again InPuE cae SOMmPputabon. or in the memory for fiature ¢ i These outpat whether ‘OOrrect incarect, and whether used as input for . feedback component of the Fig. 1, Components of a Computer System The Blue Print The relationship of the componcats is the bloe print of o computer system. Blue print is the bogic and ides transformed into aomap of bow compulcr should do things It is implemented software (instructions that tells the computer what to do) and executed through the interaction of different hardware devices (physical computer itself). Blue print also serves as the bass of how a computer functions, and how data are processed insde the COMPLE, Let os step backward, recall a eee i mouse to for = key in using a keyboard or ingut pone characters. ‘The entered data is then processed by the Central Processing Unit (C.P.U,). ‘The C.P.U. inside the compater box is just a tiny square piece of Integrated Circuit attached oa the mother rEa ai jon board that normally has ® dimension in size, its functions 10 the com e computer- functions as the brain of th ents Central Processing Unit Compom The & iain (C.P-o) has different components that OE Ts These components are: xecute instruc (ors. work cooperatively to € The command center of processor. It has three primary functions: read and interp instructions. direct flow of operations | and hardw devices, and control the traffic flow of instructions 2 data g Register a Control Unit (C.U.) A temporary storage microchip that holds d during processing. {t 18 located inside the CPU and has tt game function that of a memory, specifically the type (R.A.M.) because of its vola Random Access Memory Us. I character. This type of memory has a capability t temporarily holds data during processing, but the data stored are also lost once electric current is turned off; a a Arithmetic and Logic Unit (A.L.U.) - The most signifi component inside the C.P.U. for our iearning of the “t the scene”. It is the chief of operations of the comp A.L.U. performs two major operations in processing dé i mathematical computations (addition, —_ subtrac multiplication, and division) and logical opera (comparisons of data such as; greater than, less than, greater than or equal to, and less than or equal to). processing are the main concentration of how a ce pee data, and is the foundation of the “aml ne PTT ANC] Litas pee 14Behind the seese in acthon As we have read, the tue print of bebind the scene, i Should be clear by now why a compedter is defined at an porerinia devier that can accept, process, and sore vast amouniof data to prxtuce useful information, (Let further better grasp of behind the scene, oe eo Computer programmers writt computer instreations in COmpuler programming langwage. Just as poopie speak their native diaect, PrOQramMers write programe in different langeages: some examples am C#, C++, Visual Basic, Java, PHP ond COBOL No mater which programming lasguage o eOnipuler Programmer uses, the language has rules goveming its terminology and punctuations ‘These rules are called syeroe. Syrtnx is set of rules that povern a programming language, Take note that every programming language is unique and have their specific set of symlas, When ideas are converted imo a computer program, it is sent to the CPU for proocssiag. However, the CPU cannot untersiand the code (computer program) and will not do amything because of language incompatibility. For the CPU to understand the code, @ Language translator is neoded, The language translator ovftware is called compiler or interpreter, The role of compiler is jo transform the code info a muichine language (series of 1's and O's to represent ON and OFF states of the computer devices. It is also the representation of the digital electronic changes inside the computer), Qnce the code is compiled, 11 changes its form. from computer program with strict symiax to a readable machine language that can be interpreted by the CPU. (CPU then executes the instructions and performs the tasks. Lifeblood of a Computer System cuted b the CPU vary from simple scoeptance of data gree raorathe cof different files, Whatever task the 43cri «ine ihe nee weripuect empowers perio cafe We hal What carpus & 5 Wh nese!’ & Wh , needed to produce the Supa? Where shoulel the output go? We can mow agree thal the compuler ode is the: fi powers the computer. IL is now the role of behind the tranuiaie these ideas into a form that is easier to illastn understand. Behind the scene can be illustrated, by the te flowcharts. Flowehart ix a modeling toal used to iihust instnictions, process, and scquence using a set of sm symbols. In the world of computers we cam simply Sa flowchart is a step-by-step graphical representation of a oka The basic symbols used in programming are presemed in TableTable 1. Baste Flowchart Symeheals it Sa MBC NAME T Defines the | TERMINAL, | Sting asd ending | point of a 5 fhoewchart. | The preparation ox | ‘ S| INITIALIZATION. |, [Biialization of memory apace for | | data procesting | The inputting of | ee | | data for / / INFUTAOUTPUT | processing, und the | printing cat of | processed dala. 1 | | Manipulation af — Bk | data (asignments PROCESS and mathcroaical | computabions} | | { + | Defines the logical | 7 | of the JW LINES program. It pours = tothe neat syonib to be performed.NAME. a evamor | one f Aowchart 16 aj . iE | On - PAG i qc TOR oonmecthana » | cONNE sain pee Comnects flowchart i OFF - PAGE different CONNECTE 1 avoid 8 conection, Process: Pe : using nels =i SEs DECISION operators. Use J 1 for trapping am Variables The next most important thing io know is how represented in the program Recall that data are entered i program ising o keyboard or mouse, and the data en procesting age saved on a certain location, This location & variable Variable is a Primary storage location that can different numeric or alphanumeric values. [i is alsa a Tien Spice allocated by a computer user for processing and storin Vanables like humans need i / i Tames & Microsoft suggests a variable baming pronbieslt ae Notation. Hungarian Matation Specifies a vari5 the Data type is the type of the data berm proccsecd in | am However, data type +s language specific and may hawe ifferent representations. Table 2 shows the basic date typos with their desorption: fale 2 Basic Dain Types DATE TYPE | DESCRIPTION EXAMPLE _ "Integer | Whole number 10 3551590 _| 54765 134000 =? Final of t Integer with decimal Aldté (1.12 10 Poable murabers. 1212 9.99 O04 “(harscter Alphabets and special | J Ww A | characters | Sie ee String | Combination of am age imt_l ______| tharecters |__| a total grand ital Boobean ] Reply of the compiicr in | Values are cither | the program thai es for YES or Ofor No performed behiredl the sere wed moaly by all programming languapes Choe+,Java, Visual Basic and other programming lunguages specific | Note that the data types above are not the only data types used in gramming. Oiber programming liiguage may have their own set af ‘types with specific descriptions that are nod presented above. able 3. Sample variahe names using Hungarian Notation VARIABLE NAME | DATATYPEant in programming. However, data aa ning language In the study | will not be integrated in 4 and logic development an S por’ progt amu data types alysis Data type 1s bn is unique to every programmung, logic, discussion to allow pure ane students Variables name characteristics on for variables used with « convent ; ge are presented below: The standard namin langua any biases to any prograimoune o Must be descnphve and significant io the data, problem @ tg solution, It should be descriptive enough to identify 4 process or data 1 is referring (0. 4 Combinations of alphanumen¢ characters (alphabet, numbe and special characters) can be used as a variable na provided that it starts with an alphabet a Although the length of variable name can have 256 charact the lesser the number of characters the more efficient program is Examples class_size tuition int] Income sum char3 f name answer net_income |_name total grand_total Computer Operators: Processing Data The languages of computers 4 language that the CPU can eee For i oe instruct computers to process mathematical computatio logical operations, they would have to use symbols that Co can understand. The symbols presented are the generic § used by computers for processing. Note: As wy rogres different programming languages the mathemati tea - symbols may vary. ae 7regret Havwever, dla hy Ia the i - MAB REP Sl eae noe be iMegrated iny and loge: development an 1 Vorianhes namer chat < characters (alphabet, emmy ¢ be sed os a Variable ) alphabet q vecan hawe 23% characigd the more cificion® Examples: chass_ sine stair nel_ihcomne ‘Computer Operators: Processing Data The languages of computers peed to be converted language thai the CPU can sland For the prog TEI CoMpubers: to process: mathematical computal fogical operations, they would have to use symipols. thal oo can understand. The symbols presemed are the generic used by computers for processing. Note: As you prog differcat programming languages the malhematical and & syinbols may vary.ARTUIMETIC OFERA TORS PEA THON SYMACH EXAMIMLE | RALANA TION H Multeply ihe waltic off ire A tes the Value of veriahie i Xi¥ Thvide the valee uf vanablc XX by. the value of varalibe ¥. + ist Ue hin Ackil the walos of wanble iat) te the value of workable in A Subtract thee vadie olf variable fron the value of variable. A. den Minitiply the value of wanable * twice. MATHEMATICAL EXAPRESSIOS OOMPUTER EXPRESSIONARTUIMETIC OFERA TORS PEA THON SYMACH EXAMIMLE | RALANA TION H Multeply ihe waltic off ire A tes the Value of veriahie i Xi¥ Thvide the valee uf vanablc XX by. the value of varalibe ¥. + ist Ue hin Ackil the walos of wanble iat) te the value of workable in A Subtract thee vadie olf variable fron the value of variable. A. den Minitiply the value of wanable * twice. MATHEMATICAL EXAPRESSIOS OOMPUTER EXPRESSIONarn /y" ¥, *y¥) oF ? Ca] a*s oi?) y eee * hp) (tc * a) oF ‘ ( yeayice*a) \ important 10 pote that ti aa « jn commpulers a oe ineluded in the hierarchy PEMDAS (Parentheais, Addition and cy ara Division, LOGICAL OPERA TORS RATION | SYMBOL | EXAMPLE variable A is greater than the val aniable Be variable X is bess than the value of The value of variable tat is int] == int? | equal to the valueThe vabae of ther age? | variable aged is leas than oF equal to the | valee of variabbe aged Leet than of age! < Types of Variable The sole of variables in programming is very crucial. In the sage of a program, the variables are the repository of Tation. Depending om the obpoctive of the problem, be stored io the memory, ased for mher computation, The challes tin this stage is identifying can be clarified by describing ypes of variables. Destractive vanable — variables that destroy or change its valoe rOCeaR mE This type of variable is normally the IFy storage of data during processing. c variable — varlables that mainteins its value after 8 lustrate ee thal we have variables A and B, and the values of A and 1 10 respectively. What will happen if we have an oA =? What is now the value of A after processing the ? What is the value of B? And who gets what data the confusing part. To further illustrate: 5 | = io | these “ = Original valuex of 4Praring, proceso iis is Alter jr of ibe yanerrire At iL fas Variable B, 10, and destroyed. Th vie variables. Varneble J ‘equivalent computer ex aria io aniher bs aie from right to- left, a self from your algebra. Let it sink in to-you: ythe var of variable A, oS Mm anthmetic ex pressions: pressions to 4 bbe: ne value ad ee. | processimg. the same value tie} 1. Vol Cylinder « h: where pi is @ variable to ee eran oe F = Gms d ep) Grade = 10S Assignment + 20% Seat_Work + 30%= Quivces + 405 Bxom bh) X= fat ye — [hve] (VW ey) i ASS aes oF fh -% Ka psu [gh] Solve the problem statements by simulating the given values. of the variables below: X=S: Yell; Zols; A=2: Bed; C=6 As 2% 2 = B. What is the-valoe of BY. I X=; X= What isthe value of X? WH=C;A=X; ¥=% Whatis the valocal A? WA=B: B=C,C o X. What is the value of A? Fee ¥.¥=shi¥=2. Wats eee ux oe oF ate Br e Be a 5 & R =] non wb Ae io ee z 5 = ~~] a 9 # ¥. Vie nie oe ot erate :B=Z. Whatis the value of Jif] =A—B? ocak What is the valueof Jif J =A+B4C7 SP ee sn en aS “> i bi ft No Shes Ope WA a6CHAPTER 2 Working with Process SymbolA flowehwt abways starts ith the insiaction = START oF BEGIN... the only guadeline to remenvber imahe ternal symbol ia the comivtency of temmifologies. The ongamazedt way of writing the instraction is to use the pais START - STOP or BEGIN — END. Initighzation symbol is where you prepare the wariables to be available for use. ‘When you initialize, you are also allocating, memory spect for your data storage, As o cub, we always drew this syrebol to static the Gee of our memory. Since we use START in the opening of our flowchart, for comisiency we should use STOP to benminaic.cxcrcines bebow wg 5, ihe fenmins parca in beghe an ax ae POET To be famill puithe uss in wmnserstun pi Lah Ber eeamdly uc dace: cel Laren Bacreisant coal wwe eee + my that wil af Coto both A. aon Bb feat flerarcihet he tee € L Create hact Goat wal Ac 15, B ae | Gree a Mhowebart that 12 ‘valores of the variables are: 4 Create wi fleweckuat that will art onder where Via ighes vale. Whe value Create a fhcews bert thew Laveriad onder wherr the lowes valuc. The v Dat aunon Mo. | coe renie a flowchart thet will sire the valuof A toi, whens A. = 5. nel ysis. re If we are to. solve the problem, it is clearly stated that pjective is to store the value of variable A to variable B, We xu really interested if variable B has a value because all we o ido is store the value of variable A io variable BL We know uiabbe 6 is the destructive variable and it will destroy its. ori due and get the value of variable A. perc heart:% The use of initialization in this flowchart Aa 5 x. are three things: Beso / 1) Allocate two memory locations for é variables A and B; i | 3 2) Assign number 5 to variable A; and 3) Assure that variable B has no value. 3 ~ The expression B=A is an assignment | B= A | operation. The value of variable A, 5 is i assigned to variable B, destroying the original value, 0 of variable B. After the | assignment process, the mew value of | Variable B is 5. STOP) ath Gar © czh Solution No. 2 Problem: Create a flowchart that will assign stored value of C to both A and B where A= 15, B= 10 and C = 20. Analysis: The objective in this problem is to store the value of variable C to variables both variables A and B, we This would mean that will be destroyed. A and B. Regardless of the data stored on have to assign the value of variable Cc. the original data of variables A, 15 and B, 10The processing of data in the) START process symbol is suggested to beg detailed and precest js possible. the solution shown, we can see thagl the assignment of the data fro 4 variable C to variables A and B 7 aoe Red done separately. This is to engine sy B= 10 thal the processes are clear and dome! ‘op. 80 in a step-by-step manner If the ‘ programmer placed all th é. SRS TES 1 Oe Pireccss 3 Evol the process would Look like this: poe we can see the confusia we conn identify who Re ne and who en the aie po i .ohare Big. Problern create 2 (owehart that will move the valee of A to B and-B to C The valuce of the variables anc: A = 25, B = 30,C = 35 real Wes he greatest challenge im this os learning exercise ix not moving the 1A to-B and Bte-C, but on how to the ‘iB i will be stored toc soit ee aS uneduabely, we destroy ibe data of B, and the data on & can no er be stored tC because it was already Iau, The best way is othe swap technique. Let's illaetrate: nm vanuabbes and their values: Gl Gi & apy Moving the data of A to B destroys the value of 58 &rong o naw ee a “mecmn Moving the devtroye" wool? = i : i : ; é Sigg a f — 1 a 1 - = = _ i 4 a ew vawriable, 7 r e will need au He i Sep Tect so nae cmp. Variable during the p riabie Implementir us infrodece 2 et wlll temporarily fhobel thee dais @ i] i: ow that We have to sve e aba served. Since we know f ee date is preee t re eae ee the data of B before li accep data of B to Temp ‘Temp Wecan nin des first objective of movi fe ch as met Ving the dala of A ow a now save the data fram Temp io c I aot ‘= Ho Temp A lowchart: START ) Since we need a new variable to * save the data of B, we have as = introduced a new variable Temp. asp ) Temp is assigned a value zero (0) : to specify that there is no value in T E / _ : the variable, and a memory was allocated. The swapping technique is shown from getting the value to be = preserved, Temp = B, to placing | B= A the saved value to the desired SS variable, C = Temp. The middle process symbol is a requirement of the problem that B gets value from 35(Create a fheweh ascemhing omer Avruadl pri ; 5 7 The problem in this ue iy rast — Arta the data in ascer ing ores i direction on where to ave the arranged values. We also to understand that th te rane i jogically variable C will no dude fe process. To sienplify Ube solution, ¥ will ose the fechaique as lastrated: ext ad then We Giver, varuable : x : c Ourput Requirement” : = pe ji BB c The presence of variable 1: Temp is for th i on will be used to save the omallest ‘aus ca the <4 ; : is =ce the Mevest da in of Varkalbe rd nat kaved, we cam iow destroy the edd sities: and move the middle value to its required is —_ aS ie a Sal) we Temp A 5B c « know that the lowest value was saved in variable Temp and middle value was also moved to its location, ariuble &. To complete the swapping of data, let us move the west data to varkable A to solve the problem. It is clear that the illustration, we were able to arrange the date in lowest to ighest order in its required location os specified in the blem statement. 10 =. | Temp a B c “The (inal data of variables after conipleting the swapping process: ASPsFlowchart START ing technique is ¥% The swapPlle r = ni mh clear in this flowchart. You canj the pattern of the swapping of d a a ) from variable to variable. a 0 data was saved, we can ff destroy the data in B. In the second process, B gets | value of A, destroying the data | B. We don’t have to worry if In the first process, the data on — — a was first saved to Temp. Sines =| this process the data of B wi was already saved to Temp. In the last step, the preserved d in Temp is now saved to destroying the | ee 38Solution No. § Problem Cr aan flowchart that will arrange the values of A, B, C and D in Best to Lowest order where variable A gets the highest value and vartable D gets the lowest value. The values of the variables are: A= 3, B=9.C = 19 and hes Analysis The problem in this learning exercise is to arrange the data in Highest to Lowest order. It has a clear instruction on where to save the arranged values; variable A should get the highest value, |2 and variable D should get the lowest value, 3. We know from the given values that the highest value stored in variable C should be placed in variable A, and logically we cannot immediately move the data from C to A because we might destroy the data in A. Swapping the contents would need additional variable to temporary hold the data that we want to swap. Wariable temp will be initialized to function as temporary holder of the data to allow swapping of data from one variable to another. The solution using the swapping technique is illustrated as follows: Given variables and their values: 39ihe PO ee te Temp We ina variable A, : ; cave (ve "The presen’ that will be i eee ' variable“ Z now saved, WE con OW des 4 1h Since the data of variable A the data of and move the Highs! number. The highest value, 12, is now stored in variable A. both C an A hes the same values. We can mow de value of variable C. Since variable B has the second value, variable B will not be part of the swapping pro eno move the data from variable D to variable C 6 7|esoe —__— A E : :To complete the solution, the data kept in the temporary variable should be transferred to variable 1) 3 ae : A B (e D temp The final data of the variables after the final swapping process “HP e B Cc D a 41STAR T A = Gm 12 f Temp ¥ Temp = A Ps hd Az«C - x. Ce BD * in the first process, Ube alata A was fire saved to emg Since the dato was saved, flowchart can mow desinoy iia of A In the second and third proce A gets the value of deawoying the data Oo followed by the instrecthon moving the data of 1 te In the last process, Preserved data on Tenap th waived to 1) destroying ihe on D. Bringing back the ¢ D from ‘Temp completes ‘Upping process andTo complete the solution, the data kept in the temporary variable should be transferred to variable 1) 3 ae : A B (e D temp The final data of the variables after the final swapping process “HP e B Cc D a 41STAR T A = Gm 12 f Temp ¥ Temp = A Ps hd Az«C - x. Ce BD * in the first process, Ube alata A was fire saved to emg Since the dato was saved, flowchart can mow desinoy iia of A In the second and third proce A gets the value of deawoying the data Oo followed by the instrecthon moving the data of 1 te In the last process, Preserved data on Tenap th waived to 1) destroying ihe on D. Bringing back the ¢ D from ‘Temp completes ‘Upping process andExercises; fate a flowchart that will Solve the given problems Store the data of Variable B to wariabhe A-whete A= Sand Be It Move the duty of variable A. to vagi M ul atiables 8. Deand E, wisere 20, B = 25,0230, Dm 35 and Rad "4 a Mowe the data of variable A to B, and (to D, where a © 33, B= 22, Call, and Deda: Store the dita of variable C ap E, B to F, aed Oto A, where A = 20, Bat Cait b=, 6 240 and F = 45. Store: the data of variable D to variables A, Bad ©, and the daca af variable H to variables E, FE and G where A = 20, B= 25, C=, Dos, Bed, Fads and) Ge 3), Given the variables and dita A = 20, B = 24.0 = 30 and D = 38. Make all the values of the variables equal to the value of variable B. Swap the contents of variables A and D, and B amd C, where A= 15, B=5,Cet). b=25 md b= 30 Swap the data of variables A and B, C and DB, and E and F; where A = 20, Bo 35, Ce 30, De 35, Fedde F= 45, Arrange the values of the given variables i Lowest to Highest onder le mbintainiog their order. . Teton Fee bhe a ACR BURCED DE Ip EL a Output Requirement: As2,B=4:Cot: De §:8= 10, . Arange the values of the given variables in Highest to Lowest order intaining their order, i Se rahee chee jiikdel ik Vs 2, W=8 X= 1 Y sh: 2e4, Quiput Requirement: Veli Was Xe 6 Yeh tet aiCHAPTER 3 Input-Output | And Process ApplicationINPUT OUTPET Inpiit / Chuepeun is dhe Part of the program that the user sees, Input is the only way for the user to send data to the computer for precesting. Input data can be numeric value, character, or string. Whee the computer executes input instruction, it expects dala to be entered through a keyboard. If none is typed in, the Pompaicrs Simply waits for an input data. If'no data was entered the compaiter becomes idle gives no response. ‘To prevent this Scmino. programmers must develop the program in a way that it BAN COMMHMNICALE to the user, For the program to communicate, it must have a descriptive statement to ask the user what to do and what type of data to input. In the same manner, the ‘output should also include a descriptive statement to communicate to the user to add meaning to it making it “useful information”, Qutput instruction defines when and Where to rehease the data in the program. To clarify input and output instructions in flowcharting, let's illustrate its application. instruction: Input an integer value 5 to variable A and print the yaloc. INPUT Instruction using flowchart symbal: « [mn7 Eh It is assumed that Integer A was Shieh space. Executing the instruction, Integer 5 is stored to he A destroying the initialized value 0. Take note that the a7. aes user vane was defined in thie problem ond in meet C8? the defines mput values OUTPUT Instruction asing fowehart symbol ——_ ae / Print (A) of | 2 | f i f Ml In the given instruction. Integer § is sett out frocn variable: A. Since we are sending oul a number, we simply say Print (Variable Name). If incase we are to send multiple data we says SO In this iMustratien, we cam clearly see that the programmer defines the organization of the variables j : jetty Whe cer of vibibtee Ia Ibs cial ding out data by asnine Exercise cate a flowchart (hat ‘wall eee i 1 cpl two integers a zm cepted valums P ae See Varubles A and 8 wore axsigpeedd to O fo uncte that: the i i before ia is if the solution meets the req ? called) aes programmer use a technique rien a ee— Simao the poet of Se chan step sue the variables wed, a sop-hy ‘execution of all instructions; and the gi at each ae | see how sumulation is implemented in the given encin Flowehart Simulation Supposc thet the impos wallas for Bis # The vatec cf vasiabiles A. duloel a heceeeaeeevapping process discussed in Chapter 2. Let us S€© how lowehart will execute mathematical operations Instruction: Perform C = A +B; where A= 4, and B=6 rhe mathematical formula given tells us to add the value of the cables A and B and store the sum to variable C PROCESS Instruction using flowchart symbol: se ~~ \ ss sees Nees 5 The illustration shows that the value of the variables were added and stored to variable C. If we wish to print the sum after processing, we simply use the Output symbol as shown below: Oe |. Create a flowchart that will accept two integers and print the Learning Exercises: sum. 2 Create a flowchart that will accept a value for radius and compute and print for the area of the circle, where the formula for area 1s: 4111416 Ama=! sinnuilation, Salation & F 4 2 = START ‘ ee rcaaet jritidieallor gum = 0 seep 5 ¥ Inpat value dor A ie “ liput (A) fo 16 f ere abo for at 0 Input (B} pal ‘m0 * Add valeea of A to Bi and stone gums A+B to warkabbe sam, sim yg sing 5 r , So Print the value of sama, // Prietisuen) a $0 os —s— Note that the ougput ‘lected: {n the given solution the a ofthe problem a fen °K S sepa to compl Step 1 The variables were iniias Space amd ined 5 Ma pecing ere ae * 00 prior cm b>] iStep 2 Siep 3 hiep 4 Step § User input an imeger value § to variable A. Ueor input an (ntoger value 10. to variable B. The arithmetic operation addition was executed in the process eymbol. ‘The value inputted by the user was added. and the computed value, 18 was stored in variable seen The value of variable sum which is 15 was displayed in the Guiput screen.ing No 2. P a flowchart that will accept a value for earn com d print for the area of the circle, where the formula for area is: aa =Tir . The value of TI (P!) is 3.1416 In this problem, a constant valu > Ww initialized to variable Pi. After the initialization, Pi has now a vail 3.1416 and is ready for computer As a guide, all constants that used for computation shou initialized in the initialization sy mbo Area=0, A=3.1416 User inputs a value for radius. ‘Assume that the user input value is 5- 3 The value of Pi, which is 3.1416, ee i anaietee hy ee ae value of vari _f* "2 hich is 3 ' Area=Fi*r'2 | Cher tetera Ba [ The value of variable Area, 78.54 is (rag 75 E Pi Ars _ Output Screen 0 31416 0 la caagiaee —_ : ; Input value § for _- radius. 4 31416 0 (ae computes for Area Area = Tr’ Before the Nowehant can compute for Area let ms transform the mathematical formula to its equivalent COmputer cxpressian. ‘The problem states thar Fi will be used to represent I, therefore: the formula that the computer can understand is: Area = Pi * r*2 Performing the computation we have: Area = 3.1416 * 5°2 w 3.1416 * 25 Area = 73.54 3.1416 74.54 c ‘anes [Fass ia moved to Area, 3.1416 78.54 THS4 oie “Applications Dy. ‘Creme:a flowchart that will accept the tengthof the base , tdangk amd print te ared. oe ee ae neat the tina’ is, Area 2 4b * he where b +e the base and his the height : 3. Create a flowchart that will accept a temperature tn Fahrenheit and print its equivalent temperature im Celsius. The formula for converting Fahrenheit 10 Celsius is C = 4 (FP -F2h where F js the temperature in Fahrenheit. ; J | 9. Create a flowchart that will accept a temperature In Celsius and ; print its equivalent temperature in Fahrenheit. The Formula for converting Celsius be Fahrenheit ig F = 9/5 (C ) + 32; whene is the temperature in Celuius. 4 4. Create a flowchart that will accept the length of the side of a square and print the Perimeter and the Area. The formula for compuling the perimeter of a square js Perimeter = 4 aes Area is Area = $2; where S [Link] length of the side of the “art |. (Create a flowchan that will accept a length value in meters and” uA print its oquivalent length in yards. The conversion | 1 meter = [Link], 1 in, = 254m, a Pit=12 in lyd= 3 ft Solution No. | Problem: Create a flowchart that wi fitgoaipiiee ee heigeComputing the area of a Triangle Flowchart | START ) =a a The variables sed in. the flowchart ss initialized ate Base for the base, Hit for the a height and Area for ibe area. , Base=0 In the Input Symbol, tbe Ht=0 ) ti es eld ! and L were werithen USINE . Area = 0 yf a single WM) symbol 1 a simplify the solution. If in cases where the peoblem ay would require « soparate 1M $$ ——_—F symbol, separate the enpulteng Input (Base, Hl) / of dita. ae ans Using the conversion of | mathematical cxpressiogs 00 \ compulet expression, the Area = ( Base“ Ht) /2 — stone the product to variable Area si, = Print (Area) i (as se! Area. | 2 would mean mulipty the }Solution No, Z iré in Fahrer Hele. emperalt 1 Problerti jowehart that will accep! x Paislls The formula it, Pi wie’ ; ; a | Savertiig Fahrenheit to oe Celsins and F is the tenpasallll i perature ; the equivalent tempe Fahrenhel Analysis ‘out a temperatite Cc or will just ry direct, the use : m should compute USINg the input ¥; yputed value 18 then displayed, The problem is ve Fahrenheit and the progra and the given formula. The com Fahrenheit to Celsius Conversion Flowchart In the flowchart, the ve START used are Far for Fahrent and Cel for Celsius. # Fate f \ The formula ip Cal = 0 expression in the symbols says that the val + inputted for Far is subtracts a SCté«Y «32. The differc one en _i multiplied by 5. “ne ! ‘ i then is divided by 9. Th it result ig the Eom : a & - 7 temperature In ll ar - 92) 5)/9} Stored to vadshe ao aod = US have 100.4 as Ue, as an example Ce] = Cel 5 §{100.4 s 32) * 5) 9 ofSolution No. 3 Problem: ‘Create a flowchart that will accept a temperature in Celsius and /print its equivalent temperature in Fahrenheit. The formula for converting Celsius to Fahrenheit is F = 9/5 (C ) + 32; where C is the temperature in Celsius, Analysis: The problem is the same as no. 2 the difference in this problem are input temperature in Celsius and the formula to be used in converting the temperature from Celsius to Fahrenheit. Celsius to Fahrenheit Conversion Flowchart: oy START. To add clarity to the solution, a 7 = descriptive statement is added in the Input and Output instructions. + Far=0 S Instead of just Input (Cel), add a Cel =0 descriptive statement: Input (“Input a temperature reading ¥ 7 in Celsius: “ , Cell) Input (Cel); | , The statement describing the input is ae inside a double quote (" **) to denote a ; that the text will be printed as Is, it is | Far = ((Cel *9)/5)+3 then followed by the variable Cel to accept the input value of the user. ‘a Suppose that the user input is 38. / Print Far), = It will display the following: Input a temperature reading in Celsius: 38 (stop) 59pul ean faire wl iu 1 Pal Oe lenlayed Tas ny Pcie O the ATA te jue 38. ‘The fornia { : lies: Po (3k ited ilue Tt Far Le | a | solution Ne Problem Create a flowchart that will accept the length of the sid quare and print the Perimeter and the Area. The formula omputing the perimeter of a square is Perimeter = 4 * § and (rea = S*: where S is the length of the side of the square Anal ysis: The problem is also very direct, It requires the user to inpu the length of the side of » square. ‘The inputted value will b: ovyseti to compute the the formula given, Perimeter and the area of the square using wr solution to five use rs a better understanding. nputing the Perimeter and Area of a Square Flowchart: START a The descriptive statement re in the input and output rea =| provides a clearer understanding of what the ' flowchart is asking from rut Cau the lerctha the the user, and what the abd thesuae ~ Side! flowchart will provide This practice is standard . n programming, but for Per =4" Side the behind the scene inalysis, the descriptive statements in the Input nd Qutput in the ding examples will a how at there 7 cnpuove n both Paint (° The Peirete of th rth ¢ epee * Per acreae y und yt pul d the squares ” AreaSotation No.5 ; ; yale in Jength wales fos. that will et "The E aversion writs ay ene fees jengeh 1 yards print ite equ following 22m gaat Anil! conversion from Meter to ¥ In our Math and Physics, the poguire ihe following sept x Aft x 12 in It using the formola above we . . 4 To convert 5 meters 10 yaris have Smetes X 5.45 yards or simply ra Sees X 100 vdimeee 445 yards Let ue apply the formula in Computer expressions. Meier x Mea lee, tie ae | her 23 om Din Vards = (1 "TOD 12548 peg ) OF ean also be written 289 Yards (1) eh) | added 25 print statement Mi the “ONVErsion but the Let us see how these se formulas ary j Pemented in floyyseti to compute the the formula given, Perimeter and the area of the square using wr solution to five use rs a better understanding. nputing the Perimeter and Area of a Square Flowchart: START a The descriptive statement re in the input and output rea =| provides a clearer understanding of what the ' flowchart is asking from rut Cau the lerctha the the user, and what the abd thesuae ~ Side! flowchart will provide This practice is standard . n programming, but for Per =4" Side the behind the scene inalysis, the descriptive statements in the Input nd Qutput in the ding examples will a how at there 7 cnpuove n both Paint (° The Peirete of th rth ¢ epee * Per acreae y und yt pul d the squares ” AreaSotation No.5 ; ; yale in Jength wales fos. that will et "The E aversion writs ay ene fees jengeh 1 yards print ite equ following 22m gaat Anil! conversion from Meter to ¥ In our Math and Physics, the poguire ihe following sept x Aft x 12 in It using the formola above we . . 4 To convert 5 meters 10 yaris have Smetes X 5.45 yards or simply ra Sees X 100 vdimeee 445 yards Let ue apply the formula in Computer expressions. Meier x Mea lee, tie ae | her 23 om Din Vards = (1 "TOD 12548 peg ) OF ean also be written 289 Yards (1) eh) | added 25 print statement Mi the “ONVErsion but the Let us see how these se formulas ary j Pemented in floyyards, (START + yards 0 yard = (mater ™ 100) / (2.54 " 12° 3) * Prant (yard) sToP Teises: numbers, Moter=g showing both implementations of the converting meter | START | + i é Ena bee = fh ° yan =O r Input moter) yard = ( moter" 1.09 } = Print tare i (| Stop] te & flowchart that will solve the following problems: - Accept three qumbers and print the sum: and the inputted Accept three numbers and print the product of the aumbers. Create a flowchart that will accept three numbers and print the Ssurn, product and average of the numbers.geet tea i constant 15-6673 * is Fo Seas ee P. 15. Comite (or the grade of student gi a Oe Exam. 10% Ast + 20% Seat_Work + 30%" 75% as the pai graies vrrmed are in percentage Navin and 100%: as the perfect score. : engih, of. the adjacent Accept integer values for the | me epastio aos of a right triangle and compute and print value of the hypotenuse. The formula for computing | hypotenuse isc? =a +b 17. Accept dollar value and print the equivalent peso value. fu Nowehart will convert dollar to peso having an exchange ral of 1 isto 45.15 1B-In the mike of a yearly subscription, the rate of subscription was reduced by 5% per momih, If a sub paid an annua! Internet subscription. How much is the amount to be refunded to the subscriber. Note: use a intemet subscription at Inpart. 19. Referring to problem no. 8, how much is the monthly refund-o the subseriber, 7 20. Referting to problem no & suppose that the , subscriber did ma take his nefund and add the refundable amount for = another annua! subscription, what amount will the si heed to add for anew subscription? ;CHAPTER 4 | | Decision | | Application——————E—E——E——— DECISION APPLICATION People are given the privilege to decide. Cur daily routine entails decision-making This is a reality that we cannot escape We have to make a choice to move on, Tho moment we wake up in the morning, we are faced wiih different situations and for us: mace a derision, We always ask ourselves questions that require Secision -- Am I going to school or not? Will L eat breakfast before folng to school or eat laser during break time? Am I going to drink Jeice or soft drinks during beeak time? Will I ride a jeep or take a in-mobibe to pet home? ‘This is what decision application is all shout; it ix a way for Pegrammers to integrate decision making capability ine a ‘Program £0 filter situations that will bead to a solution, Decision epplication im fkewcharting js implemeneed using a decision Symbol. [tis the sole symbol im flowcharsting that has the abihity to Perform relational operaiions chat can filter conditions te arrive ata decision, It bas a single input and iwo-oulput choines Characteristic, The teo-oulput characteristic of the symbol it the filtering aage of a program that deiermines if the set condition in the decision symbol is either TRUE or FALSE. Remember that in Making a decision, there is no MAYBE choice, it is only a choice between YES and MO, Let us book at the simple Decision Symbol application below: pare the value of vanubles A and & the valwe of variable A is greater than the value of Variable B, P, Otherwise, add the value of variable A to the valee of isble Band store ibe sur io Variable C, tion: Comparing the value of A and f SSIS gieater thanECTS DON APPLICATION People ang gj lois decision magaas: he Privilege to decide. Our daily routine rave tO make 9 This is a reality that we canned escape, Hitt ECO, wre Choice to move On. The moment we. wake op ace a decision Gee Faced ‘with different situations and for ws sion — Am I pot f always ask ourselves questions that require ng be schook Boing to school or aut? Will I eat breakfast before é OF cat lager during break time? Am 1 poing to drink oc Saft drinks durin aera ts F mobile te get heme? break time? Will [ride a jeep or take: a Uhis ts what decision application is all about; itis a way for Ogres Ao integrate decision making capability into a woprum to filter situations that will bead to a solution. Decision application in floweharting is implememed wiing a decision mitel. [tis the sole symbol in flowcharting that has the abélity to orm relational operations that can filer conditions to anive al & Cision. ft has a single impor and two-output chooes characteristic, The two-oulput characteristic of the ric fs the filtering stage of a program that determines if the set an im the aeulen symbol is either TRUE of FALSE. Remember Usat in making a decision, there is mo MAYBE choice, it is only a choice between VES and NO, Let us look at the simple Decision Symbol application below: Given: STOF. Variable C variable B and store HEN of A and B using greater than symbol. “7ECISION APPLICATION People are 9; © zi sl tals decision-making 7 Privilege lo decide. Qur daily routine have to ma : 18 18 8 reality th “ad . We Rte we wake ui ace a decision. ei with different situations and for ie ision -- Am I going to Wes Ourselves questions that require oing to school or eat ieee ol a Will I eat breakfast before ring time? Am I goin ‘ : 2 to drink ice or soft drinks duri i Win i-mobile to get home? RE OES aE ogremnners, gee Le cai tahoe sy tr ae : integrate decision making capability into a program to filter situations that will lead to a solution. Decision application _in flowcharting is implemented using a decision symbol. It is the sole symbol in flowcharting that has the ability to peri orm relational operations that can filter conditions to arrive at a decision. It has a single input and two-output choices characteristic, The two-output characteristic of the symbol is the filtering stage of a program that determines if the set condition in the decision symbol is either TRUE or FALSE. Remember that in making a decision, there is no MAYBE choice, it is only a choice between YES and NO. Let us look at the simple Decision Symbol application below; Given: A=2:B=4,C=0. Conditions: j id B. Compare the yalue of variables Aan the value of Variable B, i is speater than 8 as ft eee ris Gane of variable A to the value of STOP. Othervrore the sum co Variable C a ee -ao the value of A and B using greater symbol. AlECTS DON APPLICATION People ang gj lois decision magaas: he Privilege to decide. Our daily routine rave tO make 9 This is a reality that we canned escape, Hitt ECO, wre Choice to move On. The moment we. wake op ace a decision Gee Faced ‘with different situations and for ws sion — Am I pot f always ask ourselves questions that require ng be schook Boing to school or aut? Will I eat breakfast before é OF cat lager during break time? Am 1 poing to drink oc Saft drinks durin aera ts F mobile te get heme? break time? Will [ride a jeep or take: a Uhis ts what decision application is all about; itis a way for Ogres Ao integrate decision making capability into a woprum to filter situations that will bead to a solution. Decision application in floweharting is implememed wiing a decision mitel. [tis the sole symbol in flowcharting that has the abélity to orm relational operations that can filer conditions to anive al & Cision. ft has a single impor and two-output chooes characteristic, The two-oulput characteristic of the ric fs the filtering stage of a program that determines if the set an im the aeulen symbol is either TRUE of FALSE. Remember Usat in making a decision, there is mo MAYBE choice, it is only a choice between VES and NO, Let us look at the simple Decision Symbol application below: Given: STOF. Variable C variable B and store HEN of A and B using greater than symbol. “7ai i Are l i ve r if ‘ + ceAek lion, Aw shown in the figure abs a a whoa i f TRUE condition, it is the ¢ th Te rise ten ihe value of B. Fence, if the valoe of ii greater than A, the given condition is FALSE forcing te awehat fo pass to the left path of the symbol. It is therefore a fact Cha the decisioa symbol has only a single output at any given point jad flowchart. Leaming Exercises: - y 6, Create a flowchart that will accept two unique integers ii print the higher integer. | 3, Create a flowchart that will accep! two unique integers fi variables int] ard int? respectively and print the imegert i lowest to highest onder. 7 P Create a flowchart that will accept two integers. If the intege are equal, print the sum of the integers, otherwise print th a 9. Create a flowchart that will input unique | Cisdprkt tehishon nein” poems inet ae 10, Create a flowchart that will accept a real estate value i compute for the realestate tax that will meet the follow a If the value of the real estate j : » fama tra ea j value of teal estate is betwee 500 7 n 250,001.00 500,000.0, tx is compuisd at 10% af the real coe. & If the value of the real estate ‘ commuted at 1S % of the real esate ya oOo a *Solution No. | Problem Create & fowehan that ; ihe higher inkeper! Will accept two unique integers and print Analysis. To solve the given . problem wcing the Pilbeal secodb sesey be ned = the Crp: [. ts chear in the problem thai the user should input two unique integers, By the given input condition, the user is not allowed to input any real numbers mor input the same integer valae. Since ihe input variables are nea given in the problem, the programmer should initialize the variables to be used. In this problem, variable A will bo used to accept lhe first unique integer and variable B for the second unique integer. Process: To solve the problem, the first thing to do is to identify which among the input value is higher? After knowing which among the value is higher, the higher value is printed and the program is terminated. Keowing the requirements and the way to selve the problem, the programmer now tras the option te use any of the relational operators to compare the integers. ‘The suggested relational operator to be used is (Greater Than (>) Take note that the dectdion symbol wall force the program to pass the path where the condition is TRUE. Output: Fr Once: the values of the integers are compared. the higherhad Bat varie A it welteg ) Taper ld iniegers ar at the highest uMeger a ‘ihe factorial of the mumvber, 7 8. Tnpet a cumber anc a> 120 ‘Ourput me> 6 Sample inpat ==> 5 Sample input=2> 3 Output 2 A fibonacci series, is a series that adidls the present series value to iis predecessor value and writes the sum to succeeding series. The sum valucs fesctions as Sie poem value in the series and add to its predecessor. sbianl tuowtoor sie eee See me eame i ret oe Easel seen Sample input ==> 21 Cee: a ih 123581321 ee SMhassarsa aCHAPTER 6 Switchgate Hels CERT are have if TO review already learned heat we have achieve MEME et os ames of forming mathematical * essing, SADTessions into computer if flowchart as a pro. vCTiNg With tigers get ing pene ool sac Merongh Ontput ay Symbol and providing Lath, InPortanc A ipalation. f variables in data clulness of Variables j terms of counter imulator, * % oat oocss mathematical and logical operations lier conditions and validate responses of users, s | came logical solutions using decision symbols, ) Provide solutions to repetitive process ta meet user quirements. oderstanding of how problems are analyzed and solwed in ¢ workd of programming. fo complete the essentials bal bce == wether important concept that needs to lead. Recall fevigUs chapters, varieties Bae three functions -- nique problem requirements. h variables. Wartable is ‘The baited used to set a condition in the "The functions of variables are Functions of variables |. Initialization Counters Accumulators E 4. Switch ach ig discussed in the. flowchart The concept of S¥" FPlication below: 113Leaming Rx Probie m1 ; , pa number and prist the Nghe flowchart thar will acee To solve the problesr, t following of ie |, Use a counter to count the number of inputs. : 3 [nitialiee variables for the imput numbers, highes number and switch. : i. Use a switeh to move the input number to the varishle holding the highest number. ‘ 4. Use a condition to terminate when the user has inputted 5 numbers. The major challenge in this learning example is how te identify the highest cumber. If we have initialized all the variables to zero (0), we are sure that the first input number is the highest We can therefore use this number as the highest number to compare the other numbers coming in to the program to identify the highest number. The switch function in this example is switching of decision symbol to a path (YES and NO path) will instruct the program to store the highest number, Tf the next number inputted is not higher than the first number then the Gecision symbol switches the program to continue accepting inputs. ‘The switch in this analysis is the variable in the decision symbol that is used to determine the highest number. The flowchart solution is shown on the next page. “ fig F 4ott he HIGH Nae Fiometaes value from to-5 and ctr, from 0 to 1.Identifying the Highest Numbe Simulation: START 4. So cr ar 5 | 5 _# mre # Input value of usep | s, High = 2 | | 7, So ctr High | J ge @ oF rae SF 5 Inga (Me) 3 4 : -_yartsbie No changes em =o + from 5 WT ya Ls the value of Mo gre Pde: i. Pees ihe switehes te NO pash. 16oS and etx, fron 2 to 3. uwIshonsil firicthon 3s High fe (malo of eer 10 High a 4 E Ce ee F * Variable No changes vileg a from 3 eo 2 and ctr, from Si x | 16. ts the value af Nol pea WO is He = | than High (10> 3)? YES thea the flow of the Por [arenes oes ee ht | £3. Variable High pete ie value of Ma, Hightnor is 1 A Ys 1Bgt 3 a 35 B - o& jace tawe fy BBE ae u Jews 2 Ect heen eo dase Pek heen 53 2 2 3 Zebra E Zebrnge 4s ath Zhe Bo 3 < 75'S aaSE di Gage ot High 10 sd > cy, 7] START * j j 9The flowchart illustration in the previous exaniple Clearly lation illustrated the function of switch. It wa: dekailed Ee ne simu thal switch can force the flow of a program (0 Ce ay instruction, In the example, switch forces the flow o Program to YES path if the user input is the highest number | We might say that the example given is easy to solve, what if we twist the problem by identifying the lowest number instead of the highest number? | am sure that you oer ane approaching the problem the same way we have solv © first example. Then you are wrong, let me illustrate why. Let us simulate to see what i. ‘ happens to the flowchay mane using the same approach. ee Simulation: s ee neo No ctr Low a 0 oO 0 =e Input value of user; ]_ / Input (No) or any number agen! No ctr Low |_or= cnr + f 0 aa 1 1 Se When we reach the switch condition, is No < Low? (05 1 ), the condition is always FALSE, and it can never move the value of No to Low. Because the value of No is compared to zero (0), The instructions here are the filtering condition of counter, and there is no number lov 4 printing the lowest number and than zero (0), of co ane loop to input another number &xcept for decimal numbers.4m cunmpar imc; paer i ip START naa , Te te La Rowehast, wc 2=[Link] Ubea thee ty a al tale inne, rk allowed er ore than five tienes i M Migilates the problem put No) TOWWUEMeR. “The flowchart . H Wee weer io ing aia ' Times weve othe = fret Per; hugober inputted was mat included in the counter Take ote that the function of counter is to Mont the number of bnpur the uner has made, and it lemmittates the program. when the value of counter is 5 Another eve sore im the sobstion ix the use of to Inpul symbols for the same wariable Te other words, thas approach will siall mot moet the problem requirement 50 what is the solution? Is there a solution te thas problenn? The best way to solve the erm is WO ust eo switches. Printing the Lowest Number Analy : cal to say that the first 4 ayurnber, it is FORT ber that all the ite a ee or highest, Reims 3 el ial4m cunmpar imc; paer i ip START naa , Te te La Rowehast, wc 2=[Link] Ubea thee ty a al tale inne, rk allowed er ore than five tienes i M Migilates the problem put No) TOWWUEMeR. “The flowchart . H Wee weer io ing aia ' Times weve othe = fret Per; hugober inputted was mat included in the counter Take ote that the function of counter is to Mont the number of bnpur the uner has made, and it lemmittates the program. when the value of counter is 5 Another eve sore im the sobstion ix the use of to Inpul symbols for the same wariable Te other words, thas approach will siall mot moet the problem requirement 50 what is the solution? Is there a solution te thas problenn? The best way to solve the erm is WO ust eo switches. Printing the Lowest Number Analy : cal to say that the first 4 ayurnber, it is FORT ber that all the ite a ee or highest, Reims 3 el ialr nitialized to vere CO) amd the first input | ase lowest rambor Docaeee there 00 mame | tow, of we can aah a switch to force the fn, variable Low, then We are assured thay + amber twin vara OMe ee the Essig of a | first inpat wo variable. low 1 8 path = by sitet, then it can te, switch back to the other path. to deny passing through He as, n for the snccending loop The switels application in gs, cy rangle iniwoton and IHicy ) proce: arwcrionns dev thee Rowe. wit edd be pocrice fe fo process the rest of the os ar back Mow what we have understood how to solve. the we are now faced with o new challenge How do we set the thal will switch once and switch hack for the rest of the loop? 5; there a way to implement this? The solution is to wie the value-of counter to function a5 4 switch, If we have the counter, ctr = ctr + 1, the value of becomes one (1). If the next instruction i& a@ @ecision symba asking if the value of C = 17, then the condition is TRUE, ber to variable Low. This is t mow move the first input num after moving the data to variable Low, the program retire symbol to accept the next sumber, After accepting the input, counter increrments io 2 (cir = ctr + 1), then the o the decision symbol C = 1 becomes FALSE, and it willl true because the value of counter will continue to increase the program to process the rest of the instructions ¥ the YES path of the switch, (C = 1) in the succeeding The rest of the program performs the filtering number inputted and storing it to variable Low, after five inputs, the program satisfies the condition C the lowest number and terminates the program.pritiOk ihe Lawes st Nemee 3. Switch fenetion: 1s the value of ctr = 17, YES, move value of ‘Now Lowthe Lowest Number Flowchart Continuation 1; Printing . | Simulation: START | 4, No ctr _= Fi] g 4 5 ] Ma = 0 G toce ——» Input number : § t—_ , 6 : x Ff & 2 ctr =ctr + 1; 2=1+1 i WY No ctr Low 6 6 5 6. Switch function: Is the value of ctr = 17, NO, pass to NO path. Notice here that the Condition forces the flow — to pass to the NO path. 7. Filtering: Is the value of NO Less than Low? , Is (8< 5)? NO 8. Monitoring number of users: Is the value of ctr = 5? NO, ctr = 2.; Loop and returns to Input and accepts a number.Is the value of ctr = 17, NO, pass to NO path. 12. Filtering: Is the value of NO Less than Low? Is(3<5)? YES move value of No to LowPrinting the Lowrst Somber Mowchart Continaation 3: | ‘i Sirvulacion | 13. Monitoring, ray af users: imity Ls the vahae of ctr 5 NO), cir eh: retums 1 Input and Ey aceepis a number, = id. No ctr Low s 8 8 z xc r+ §# cobb £ # 3 rs aja «= (pot number: & Is. No ctr Low 6 68 ‘ & F eo a £ 7 6 4 cir =etr +1; d= dw] 16. Sowhtch fumetion: Is the value of ctr = If, ici: NO), pass to NO path, [rete / le. 17. Filterimg: | 15 the value of NO (sor) Less than Low? — Is (6 <3)? NO,Flewehart Cuntinuation A: Priating thr Lowe! pore be Sprmubacion: i. Monitoring ef Users; Mle fs lhe values of MO, cir = 3; let nena: bo Input te. accepts 3 Mater 4. Ne Fi) © a 5 , rr * e ona 16, Switch function: Is the value of ety =f NC}, pass oo NO path | 17. Filtering: Is the value of NO Less than Low? Is (6-< 3)? NO,pein the Lowest Number = char Continuation 4: \ Bier) — Simulation: th Monitoring mumber fier ‘of users: Clmae ‘ x) ithe value of ctr = 5? ] : | NO, ctr ed; Loop and } "reg eedt Is the value of ctr = IT, NO), pass to NO pathPrtating the Lowest Number Flowchart Conta 7 / Simulathon: (amr) No ctr Low 7 6 68 «@ | et (aa £24 Nv twat? e a t e # 1 5 | ot teput (Fat 22. Filtering: i . Es the value of NO | 4 Less than Low? eeoret Is( 1<3)? YES, move value of Notoie ene ’ he she set By Une to fp lowest nutes, "or ne na fol ite the numbers dae WO highest otter ant tc a that are in the arcs: and we want 4 y to solve ‘our Odd sequence, can you thin “ ysesnent aM lUStration is shown ben mtettame. further Nun bers given ane ; a4 5, 6, 7, 8, 9, 10 Requirement: Separate the numbers in the odd sequence to manipulate, z a ire oof, ae Z EVEN SS, Na, Ss 3, 10 lt we look closely, we cam see that there is a pattern in separating Uhe mumbers im odd sequence {rom the numbers in the even sequence. If we replace a mamerit. code for odd and even by wero (il) and one (1) respectively, we will have: opp wh ah 0 EVEN he en 1. ‘ ic codes, we cas. sec that In the representation of aumney: Lat there is reallly a pate that spas eps vee EVEN sequence mumbers e analyze the paliem conclude that the nasmeric code _ aoa = ea rte this to peOgramain, °° changes form 0 10 lO, These charges 67 0 imple he pth in very lop ‘alysis the application F switch ele, = 1 Se eescaming Example feats a Flowchart that will print he odd sequence Integers sue oftvariable No, where. variable Noigequal to 10,” The variables | are:too SF = 10 NO, = 1 nd tetarn to counter. 4 No ow bot 2 Secret; 2— 1 +1 3. Switch function: hSW=O)[Link] and astign Oto SW. & = ‘Mesiioring = counter value: ctr = 107 NO, ctr = ‘2, boop and remen to courter. athe ODD sequence integers af 10 Continnation 2: 7. No SW ctr TAH io ke tog € a z No = 18,€ 3 Siw a gr=er+ 1:3 = 2a 1 | 8 Switch functhon: fteac+! (——" | is SW = 0f Veo | the value of ctr (3), ga] _—— jf isign 1 to SW. = a x swe No SW oe eal 10 g ¥ 7 a SWind Prind (ct) : 9. Monitoring value: Isctr = 107 NO, cirs and return tothe ODD. Psouation a: Cheers 1.42341 ae LL, Switeh functing: f Woe zi Is SW =07 NO. | * assign O to SW. No io oe hag ahuanng 12. Monitoring counter value: [set = 107 NO, ctr = 4, loop and retum fo countercs of 10 Printing the ODD sequence intege conthmantion 4: 13, No sw STANT | in of r o £ 0 wae ken Se ¥ | exaees 1; 52494 an ep Se + | 14 Switch function: “ Is SW = 0? YES, pr we eae | the value of ctr (5), a WO. ew we Hissign 1 to SW. ? Mo 10cs of 10 Printing the ODD sequence intege conthmantion 4: 13, No sw STANT | in of r o £ 0 wae ken Se ¥ | exaees 1; 52494 an ep Se + | 14 Switch function: “ Is SW = 0? YES, pr we eae | the value of ctr (5), a WO. ew we Hissign 1 to SW. ? Mo 10SW ctr io 0 6 is og o og x + A 1 sF 6 Potrect+1;6=541 teeter = 107 NOL ctr =6, loop and netumn to oounber.“rs of vi nieye Printing the OO sequen’ tal continuation 6: 19, No SW ctr 10 START 4 ie ky ee sw » | aig eh WAS a4 oe 20 Switeh function: toc yes fh Is SW = 0? YES Ie ee owe? } the value of ctr (7), and) : assign 1 bo SW, Sw 20 Print (ott Ae sw clr 0 a Zz x a £ # 7 | 21. Monitoring alne; Is ctr = 107 NO, | loop and return to a Ct ce + 1, 7 ag +1“rs of vi nieye Printing the OO sequen’ tal continuation 6: 19, No SW ctr 10 START 4 ie ky ee sw » | aig eh WAS a4 oe 20 Switeh function: toc yes fh Is SW = 0? YES Ie ee owe? } the value of ctr (7), and) : assign 1 bo SW, Sw 20 Print (ott Ae sw clr 0 a Zz x a £ # 7 | 21. Monitoring alne; Is ctr = 107 NO, | loop and return to a Ct ce + 1, 7 ag +1: of 10 Printing the ODD sequence integer® ‘continualion 6: 1 No SW ctr in Oo @ STAR! | a ao + of = a 4 "BIN tf 0 oe . 7 ms i ctr er + 1; oe I v | 20 Switch el ves is SW = 0? YES. print Sowao | the value of ct (7), an ee | assign to SW. i tr . Swed Print (ett = ” on i of a 2 + ¥ A # i. Ff e if t F ai OUTPUT Display 1,3, 5,7 ) + = 21. Monitoring counter valloe: ———» icir = 107 NO, eral | loop and retam tony the ODD | resto 7 MMRENCE Teteees of 10 Hiowchar o r z i = F x z & crectr+ |; B= 7+ 1 ‘a 23, Switch function: \ Is SW =07 NO. 4. Monitoring counter Tecir= 107 NO, ctr = 9, Joop and rerum to coWMES:Printing the OD? sequence integers of 10 comtineaition: 5: as. No sw ctr 10 wa fF Sian _ oo TAN ay aes he os t e a= | Z # . ron coe 3 9ey Seah Shag tape ny RY he RB creer | -We d+ 1 ikmercies: Create a floweli chiw 9, 10. Enter 10 numbers and print the 8” number 25 times. ict that will solve the given : Ener (CO members and pecs (he highest are the lorwest mumiber, Eniey 10 immbers and print the 7 surnber and thet sun of the and 149° pumnbete Reser 10 puenbers and print! wom of the EWEN sequen mune Enter if) cumbers and pent the highest eames in the CODD numbers Fister 10 mambers and peint the jowest in the EWEN sequence: Peder 10 nambers asd print the lowest number in the EVEN si and highest in the Odd sequence oumibers, 5 Enter UO) nuenbers and peiat the average of the ODD sequence x and the product of the EVEN sequence eumbers. Enter 10 student grades andl parvo ihe total mumber of passing and failing grades entered (passing grade is 75 and above). Enter 10 nurabers and print the elifference of the highest num odd! sequence and the Jowest number in the EWEN sequem. he numbers of the CTD sequemce| CHAPTER 7 | | | : = Functionswi rroONs Wy ¥ | yl baskethal| ig ¥ vhere Spectar Ske ye team 10 Win, uns Ate up aa their ge NO Watch. 1 ‘Sa Teal crowd gor tne! t with their ions heaping 4 basketball fame ig 5 L Bas ‘ oo Ij wers each pie Player 1D the tenetition between tw teams with § pie ies mong the Players Is iy ally tha a 4 Unique Tole to play. The * sm af orchestrating and Ball Ht or Point Guard: it yes Forward. This POSition has Se - Eame. ‘nother position in i Mjributing the ball and givin tO the uae *SSiSting the bill hare \ p cond tallest position in the tea the eed Mle 10 score \ The welping the Cen This position has a pole Bilis he Center. ™ Cc = ender the basket and on tat ‘ tio ee sing tk CDler ig tallest Player in the team; its pon sk 1S BENING the ball tinder the goals ending the | gor scoring. To make the tam compe, tae combines his eam | Mee wo Forward Players With one Guard, or two i a y » Or two Guard players with il forward player with a Center ang 4 Ball Handler to complete the in er five PHD ‘very Bame, the players perform their duties routinely, the jandier plans, the Center te the Forwards assists the ball ee cute the plan, and the Guards help the See te te Me ie These are the routinary duty of the players: pame er game. bouras ‘ Bir we Can understand that each player has a specific role to we LOOK CHORS Ts form, but no matter what unique function a player performs in a team Ca of ihe team is to play in harmony as one. the goal of i jor parts, the A, program is like a beeketel oe: oe two mor pas the : ogram and the be a eg ei jr orchestrates the implemen Ms | pote 2 esi se oF a ee is interesting i as one to like the other positions 10 nai : ability of all these sub-progr function harmonious! solve the problem. ‘ in this explanation ific task insh The underlying Ost pert co 4. function a junction iS @ apes a ae program. | e ion ca ; eee Popram. For fur unction ons i : iariction is executed. Fi the ine peo iler to after Pe ariable iistructs the compl program of all ioutine and returns to the Mase composed Hain program is the program 143Ayncuons imple entation, hs Ths , bil) inctian calls °C programming. becatige instruction execution Feit nod 1 Other authors refer to aS modules
You might also like
COMP 20013 - Introduction To Computing 2021
PDF
100% (3)
COMP 20013 - Introduction To Computing 2021
103 pages
Computer Literacy Basics Guide
PDF
100% (1)
Computer Literacy Basics Guide
43 pages
Overview of C Programming Basics
PDF
100% (2)
Overview of C Programming Basics
69 pages
C++ Problem Solving Lab Manual
PDF
No ratings yet
C++ Problem Solving Lab Manual
50 pages
Computer Programming 1 Overview
PDF
100% (2)
Computer Programming 1 Overview
100 pages
C++ Prelims: Multiple Choice Questions
PDF
No ratings yet
C++ Prelims: Multiple Choice Questions
3 pages
Programming Fundamentals Lab Quiz 01
PDF
0% (1)
Programming Fundamentals Lab Quiz 01
1 page
COBOL Programming 3 Syllabus at PUP
PDF
No ratings yet
COBOL Programming 3 Syllabus at PUP
6 pages
C++ Programming Lab Exercises Guide
PDF
No ratings yet
C++ Programming Lab Exercises Guide
15 pages
Introduction to Programming Logic
PDF
100% (2)
Introduction to Programming Logic
60 pages
Capstone Project Chapter 1 Overview
PDF
No ratings yet
Capstone Project Chapter 1 Overview
40 pages
Introduction to Computing Overview
PDF
90% (10)
Introduction to Computing Overview
10 pages
Digital Logic Design Fundamentals
PDF
No ratings yet
Digital Logic Design Fundamentals
24 pages
Introduction to Computing Concepts
PDF
100% (1)
Introduction to Computing Concepts
10 pages
Intro to C Programming by Pepito
PDF
No ratings yet
Intro to C Programming by Pepito
223 pages
Flowcharts in Programming Education
PDF
No ratings yet
Flowcharts in Programming Education
28 pages
CSC111
PDF
No ratings yet
CSC111
76 pages
CC 102: Computer Programming 1 Syllabus
PDF
No ratings yet
CC 102: Computer Programming 1 Syllabus
13 pages
Understanding Computers Fundamentals
PDF
100% (1)
Understanding Computers Fundamentals
35 pages
CC102: Intro to Computing Syllabus
PDF
No ratings yet
CC102: Intro to Computing Syllabus
17 pages
CSC211 Data Structures Lab Manual
PDF
No ratings yet
CSC211 Data Structures Lab Manual
95 pages
BSU IT 113: Computer Programming 1
PDF
No ratings yet
BSU IT 113: Computer Programming 1
9 pages
Computer Organization and Architecture Overview
PDF
100% (2)
Computer Organization and Architecture Overview
55 pages
Introduction to HDL Course Syllabus
PDF
100% (1)
Introduction to HDL Course Syllabus
5 pages
Module 5 - Week 7 and 8 - Platform Technologies PDF
PDF
50% (4)
Module 5 - Week 7 and 8 - Platform Technologies PDF
46 pages
Module 1 - Week1 and 2 - Platform Technologies PDF
PDF
100% (3)
Module 1 - Week1 and 2 - Platform Technologies PDF
54 pages
Self Study BSIT
PDF
0% (1)
Self Study BSIT
186 pages
Introduction to Computing Module 2024
PDF
100% (1)
Introduction to Computing Module 2024
11 pages
Data Structures and Algorithms Syllabus
PDF
No ratings yet
Data Structures and Algorithms Syllabus
11 pages
Fundamentals of Computer Programming 1
PDF
0% (1)
Fundamentals of Computer Programming 1
22 pages
Discrete Structures in Computer Science
PDF
No ratings yet
Discrete Structures in Computer Science
16 pages
Programming Logic and Design Overview
PDF
100% (5)
Programming Logic and Design Overview
8 pages
Software Classifications and Functions
PDF
No ratings yet
Software Classifications and Functions
60 pages
CPE 112 Programming Logic Syllabus
PDF
No ratings yet
CPE 112 Programming Logic Syllabus
17 pages
Introduction to Computing Syllabus
PDF
No ratings yet
Introduction to Computing Syllabus
5 pages
Introduction to Computer Architecture
PDF
100% (1)
Introduction to Computer Architecture
5 pages
Fundamentals of Computer Programming
PDF
No ratings yet
Fundamentals of Computer Programming
15 pages
Digital Logic Design Course Syllabus
PDF
No ratings yet
Digital Logic Design Course Syllabus
9 pages
System Fundamentals for IB Computer Science
PDF
50% (2)
System Fundamentals for IB Computer Science
14 pages
Application Development Basics in PROG 301
PDF
100% (10)
Application Development Basics in PROG 301
50 pages
Understanding Algorithms in Mathematics
PDF
No ratings yet
Understanding Algorithms in Mathematics
27 pages
Introduction To Programming 1 (JEDI)
PDF
No ratings yet
Introduction To Programming 1 (JEDI)
289 pages
BCA-204: Programming Languages Syllabus
PDF
0% (1)
BCA-204: Programming Languages Syllabus
2 pages
Discrete Structures 1 Overview
PDF
No ratings yet
Discrete Structures 1 Overview
8 pages
Assembly Language Jump Instructions
PDF
100% (1)
Assembly Language Jump Instructions
125 pages
Components of a Computer System
PDF
No ratings yet
Components of a Computer System
34 pages
Computer Programming 1 Syllabus
PDF
No ratings yet
Computer Programming 1 Syllabus
9 pages
Digital Systems and Binary Numbers
PDF
100% (4)
Digital Systems and Binary Numbers
55 pages
Introduction to Computer Programming
PDF
100% (1)
Introduction to Computer Programming
96 pages
Overview of Platform Technologies
PDF
No ratings yet
Overview of Platform Technologies
39 pages
Understanding Variable Types in C++
PDF
No ratings yet
Understanding Variable Types in C++
8 pages
C++ Lab Manual for ISC 115
PDF
No ratings yet
C++ Lab Manual for ISC 115
36 pages
EE1005 From Computational Thinking To Programming - OBTL
PDF
No ratings yet
EE1005 From Computational Thinking To Programming - OBTL
5 pages
Introduction to Event Driven Programming
PDF
100% (2)
Introduction to Event Driven Programming
27 pages
HCI Midterm Exam Reviewer Guide
PDF
No ratings yet
HCI Midterm Exam Reviewer Guide
4 pages
Graphics and Visual Computing Syllabus
PDF
No ratings yet
Graphics and Visual Computing Syllabus
11 pages
Computer Flowchart Basics
PDF
100% (1)
Computer Flowchart Basics
30 pages
Solution Manual For Computer Science An Overview 11th Edition by J Glenn Brookshear
PDF
No ratings yet
Solution Manual For Computer Science An Overview 11th Edition by J Glenn Brookshear
61 pages
Overview of Language Processing Systems
PDF
No ratings yet
Overview of Language Processing Systems
6 pages
Basics of Programming Logic Formulation
PDF
80% (10)
Basics of Programming Logic Formulation
19 pages