0% found this document useful (0 votes)
11 views

Flowchart 1

Uploaded by

Nikka Camu
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
0% found this document useful (0 votes)
11 views

Flowchart 1

Uploaded by

Nikka Camu
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
You are on page 1/ 16
LESSON 4 Computer and Programming Concept OVERVIEW This lesson introduces you to computers, software or programs, problem solving and how to write programs/instructions using algorithm: flowcharting and pseudo coding specifically. Objectives After completion of this Instructional Material you should be able to: Understand theoretical concepts in programming Utilize the algorithm tools in writing programs/instructions Learn the different program control structures, Become a better programmer in your own programming language COURSE MATERIAL: Watch: Programming Language Concepts hittps:/www. youtube. com/watch?v=nV1HAbGvQMA Algorithm using Flowchart and Pseudo code Level 1 Flowchart https:/Avww. youtube. com/watch?v=vOEN65nm4YU Flow Chart and Pseudocode https/Avww. youtube. com/watch?v=O8VPR3zhSgo Read: Concept of Hardware and Software https:/)www.tutorialspoint.com/computer_concepts/computer_concepts_hardware_softw are_concept.htm Computer Accomputer is an electronic device that accepts data from the user, processes it, produces results, displays them to the users, and stores the results for future usage. Data is a collection of unorganized facts & figures and does not provide any further information regarding patterns, context, etc. Hence data means "unstructured facts and figures". Information is a structured data i.e. organized meaningful and processed data. To process the data and convert into information, a computer is used. Hardware and Software Hardware The term hardware refers to mechanical device that makes up computer. Computer hardware consists of interconnected electronic devices that we can use to control computer's operation, input, and output. Examples of hardware are CPU, keyboard, mouse, hard disk, etc. Video Cord Sound Card EREAELRERLLARLY Motherboard Hardware Components Computer hardware is a collection of several components working together. Some parts are essential, and others are added advantages. Computer hardware is made up of CPU and Peripherals as shown in image below. Keyboord Monitor Mouse SY Printer nS maT Other UP devices -——.—J Speaker Woo © Other /P devices Memory ‘Other O/F devices ios Software A set of instructions that drives computer to do stipulated tasks is called a program. Software instructions are programmed in a computer language, translated into machine language, and executed by computer. Software can be categorized into two types ~ + System software + Application software System Software ‘System software operates directly on hardware devices of computer. It provides a platform to un an application. It provides and supports user functionality. Examples of system software include operating systems such as Windows, Linux, Unix, etc. Application Software ‘An application software is designed for benefit of users to perform one or more tasks. Examples of application software include Microsoft Word, Excel, PowerPoint, Oracle, etc. Differences between Software and Hardware are sorted out below— ICE be be fed bel be Excel OneNote Outlook Word PowerPoint Program and Programming ‘A computer is a tool used for processing data into information. The processing is controlled by a set of detailed step by step instructions. The list of instructions that the computer must follow to 10 be able to process data into information is called program or software. These instructions consist of statements written in a specific programming language. When a program is written, we are basically solving a problem. To solve a problem, we need to use our mind power or logic to develop the detailed instructions. ‘The procedure of developing the detailed instructions for the computer is called programming. It is a five-step process namely: Define the problem Design the solution/program Code the program Test the program Document the program geen The problem definition step means that there should be clear understanding of the problem. It requires performing the following: Specify program objectives and identify the users of the program Specify the output requirements. Specify the input requirements. Specify processing requirements. Study feasibilty of implementing the program. Document the analysis, oP keNe In designing the program, the following steps are done: 1. Determine the program logic through top-down approach and modularization, using hierarchy charts, Design details using pseudo-code and /or flowcharts. Test design with a structural walkthrough. Structural walkthrough consists of reviewing process with other programmers and system analyst and scrutinize (‘walkthrough’) the programmer's work, Program coding is the step which translates the logic of the program based on the pseudo-code (algorithm) or flowcharts into a high-level programming language using the syntax and semantics of the specific language. ‘The steps include: 1. Determine the appropriate programming language to use. 2. Code the program in the specific programming language decided on Program testing consists of desk checking, debugging, and running real data to make sure that the program works. Desk checking is just reading through or checking the program manually to ensure that it is free from errors and the logic works. Debugging means detecting, locating, and removing errors in the computer program. Error may be syntax errors or logic errors. Syntax uw errors can be typographical error or incorrect format of the statement used. Logic errors are caused by incorrectuse of control structures. Documenting the program consists of the written descriptions of what the program is all about and how to use it, The documentation should prepare for the users, operators and the programmers. The steps are as follows: 1. Write user documentation. This is the manual that is prepared to help the user use the programs. 2. Write operator documentation. This manual gives the computer operator information on what to do when the program flashes an error message. 3. Write program documentation. The program documentation consists of the testing of the whole programs. This documentation helps train the new programmers to maintain existing system. Maintenance here means keeping the programs in working conditions, error free and up to date. PROGRAM LOGIC FORMULATION Program logic formulation is a step-by-step development of a solution to a given problem. This is the most difficult part of solving a problem with a computer. After you come up with a method of solution, itis a routine to translate your method into the required language, for example C language and any other programming languages. But we must concentrate first how to develop the step-by-step. (This workbook will orient you to C based algorithm). ‘There are two most used tools that will be of great help for you to formulate a better solution. These are the flowchart and algorithm. TOOLS USED IN THE DEVELOPMENT FLOWCHART The first tool is a flowchart. It consists of boxes with different shapes that contain simple statements or sentence commonly called instructions and connect together by lines. It is easy to understand because its solution is represented in a picture. ‘Symbols used in Flowcharts Data Indicates Data Stored Data Indicates data stored in formats suitable for processing ‘Sequential Access Storage Indicates only sequentially accessible data such as those on magnetic tapes & cassette tapes 2 DirectAccess Storage Indicates directly accessible data, such as those on magnetic disks & floppy disks Documents Indicates data on media human beings can read Display Indicates data_on any medium that displays information used by human beings, such as monitor Toop Limit Composed of Wo parts, condition for termination and loop name are written in the symbol indicating the start & the end of the loop respectively Terminal Symbol This oval, which contains either the word start or the word stop, indicates the starting and stopping point in the flowchart. A flowchart can only have one starting point but it may have many possible stopping points. INPUT/ OUTPUT Symbol This parallelogram is used for INPUT and OUTPUT instruction. INPUT means to enter data into a computer or to use the computer to read the available data from magnetic disk. OUTPUT means to display the result of compilation or condition of the given solution Processing Symbol This rectangle is used for ay data processing operations for which requirements of the problem are usually done here. Examples are computation of average, and assignment of the value to the variable. Decision Symbol This diamond-shaped symbol contains a condition. If ‘the condition is true, the marked path TRUE is to be followed. If the condition is false, the marked path FALSE is to be followed. ‘Arrowheads/Flow lines ‘Arrows are used to direct the flow of the flowchart. It shows the flow of the solution. Connector Itis used as a continuation symbol of a flowchart. It shows the flow of the solution. Initialization/Preparation Symbol itis used to initialize variables not explicitly defined in the input but a requirement in the production of the output B Figure 1-1. Flowchart Symbols Io QO OULD 1 +t O TYPES OF FLOWCHARTS STORED DATA SEQUENTIAL ACCESS STORAGE DIRECT ACCESS STORAGE DOCUMENTS DISPLAY LOOP LIMIT TERMINAL SYMBOL INPUT/OUTPUT SYMBOL PROCESS SYMBOL DECISION SYMBOL ARROW/FLOWLINES, CONNECTOR ‘+ System Flowchart (process chart) ‘+ Program Flowchart 4 ‘System Flowchart — indicates a flowchart for a targeted system as a whole A System Flowchart example Evaluation of Class cards Inputted _—__* Evaluated Class cards are Checked ¥ , | Sorting of class cards Sorted class cards ¥ [Bette pring Grade sheets ¥ Grade sheet reports Lo Detailed printing of class record class record LE >| Computed Micterm ‘Computation of final grade sheet 15 Program Flowchart —is used to describe processing procedures based on detailed analysis. This module will discuss in detail the program flowchart. System flowchart will be discussed thoroughly on System Analysis and Design. Flowchart Development The steps that comprise a flowchart must be organize in an orderly, understandable, and clear manner so that the program that implements this flowchart is similarly in an orderly, understandable, and clear manner. An orderly, understandable, and clear solution is called Structured Flowchart. Structured flowcharts are design using the three most basic methods of control. The basic methods will be our guide to produce a correct structured flowchart necessary to prepare a correct program. 1. Sequential — steps are performed in a strictly sequential manner; each step being executed exactly once. This is the simplest method of control. It is easy to develop and understand Figure 1-2 shows flowchart on how to determine the product of the three numbers START v INPUT A, B,C P=A"BYC ¥ / ourpurp 7 16 2. Selection Structure — One of several alternative actions is selected and executed. It involves the use of decision based on the given condition. It use decision block or the diamond- shaped block. Alternative action will be represented by a processing block. Figure 1-3 Flowchart that determines if the average of the student is "PASSING" or “FAILING” START AVE AVE> 75 YES OUTPUT “PASSING” No ¥ ‘OUTPUT “FAILING” STOP — 7 Figure 1-4 shows the flowchart that will determine the positive and negative number. “NEGATIVE” YES ouTPUT INVALID STOP 18 3. Repet n Structure — One or more steps is performed repeatedly Figure 1-5 Shows the flowchart for the printing of all odd numbers from 1-10. START Loop 1 TWLN=10 Figure 1-6 Shows the other approach of flowchart for the printing of all odd numbers from 1-10. START ¥ > opp =0p0+1 These three structures appear to be very simple, but in fact they are sufficiently powerful that any flowchart can be constructed using them 20 ALGORITHM Algorithm is a set or series of instruction for carrying a task. It is also a procedure to produce the required output from the given input. It is similar with a paragraph that expresses a single thought. It uses English language. Its also known as pseudo code. Algorithm Development The steps that comprise an algorithm are similar with flowchart. It must be organized in orderly, understandable, and clear manner so that the program that implements this algorithm is similarly orderly, understandable, and clear manner. The three basic methods of control used in a structured flowchart are also applicable in structured algorithm. 1, Sequential 2. Selection 3. Repetition Pseudo code is a mixture of language and symbols, terms and other feature commonly used one or more high-level languages. High-level languages are programs used by the computer. Typically, the common features of various pseudo codes that appear in textbook are the following 1. The usual computer symbols are used for arithmetic operations: “+” for addition, *-" for subtraction, “*" for multiplication, and "7 for division 2. Symbolic names (identifiers) are used to represent quantities being processed by the algorithm. 3. Certain keywords that are common in high-level language may be used, for ‘example, read or enter to indicate input operation: display, print and write for output operations, 4, _ Indentation is used to set off certain key blocks of instructions. The structure of an algorithm can be displayed in a structure diagram that shows the various that must be performed and their relation to one another. These diagrams are especially useful in describing algorithms for more complex problem. This section will show similar examples used in flowchart development that will ilustrate the three basic control structures — sequential, selection, and repetition and how to present algorithms in pseudo code. 1. Sequential structure Figure 1-7 Algorithm that shows the printing of the sum ALGORITHM sum A->0,B->0,SUM->0 INPUT A, B SUM>A+B OUTPUT SUM END sum 2 Figure 1-8 Algorithm that shows how to determine the product of three numbers. ALGORITHM product A>0,B>0,C->0, PRODUCT->0 INPUTA, B, C PRODUCT >A*B*C OUTPUT PRODUCT END product 2, Selection Structure Figure 1-9 Algorithm that shows how to determine the positive and negative number. ALGORITHM pos_neg N>o INPUTN IF N<0 THEN OUTPUT “NEGATIVE” ENDIF IF N ==0 THEN OUTPUT “INVALID” ELSE OUTPUT “POSITIVE” ENDIF END pos_neg 2 No.4 Name Date: Year&Section: Score: 1. Differentiate hardware and software. 2. Differentiate program and programming. 3. What are the components of hardware? 4, What are the types of software? 5. What is data? 6. What is information? 7. What are the five-steps process of programming? 8 What are the following steps necessary in program design? 9._ Differentiate syntax error and logic error? 10. To have a clear understanding of the problem, one of the requirements is “Specify the program objectives and identify the users of the program’. Explain it briefly ANSWERS 1 2 3 za 5 6 Z 23

You might also like