Logic Formulation What is Logic Formulation The process
- Slides: 73
Logic Formulation
What is Logic Formulation? The process of coming out with the basic steps to implement a procedure in computer programming. This is usually resorted to when having top-down design. Flowcharts and pseudo codes are the two of most common output of the exercise. http: //au. answers. yahoo. com/question/index? qid=20071110191353 AAB
What is Logic Formulation? …. l Bringing the steps as required by the task in PROPER ORDER so that when it is executed procedurally the desired result is achieved according to the required output specification. - Nilo M. Padre
Basic Control Structures (logical constructs that specify how instructions in a program are to be executed) l Sequence l Selection l Repetition l Unconditional Jump
Sequence l Instructions are designed to be executed (performed by the computer) in the order they are written (i. e. , one after another). This control structure provides the building block for computer programs. It is used to show a single action or one action followed in order (sequentially) by another. Actions can be inputs, processes, or outputs.
Example l. Go to the phone l. Dial the pizza place l. Order the pizza l. Hang up
Sequence Structure
Selection (conditional, branch, or decision) l The program branches off to different instructions depending on whether a condition is met; or, one of several blocks of program code is executed based on a test for some condition. It is used to tell the program which action to take, based on a certain condition. When a condition is evaluated, its result is either true or false. If the result is true, one action is performed; if the result is false, a different
Example Open your wallet l. If you have enough money, l. THEN Go to the phone. l. Dial the pizza place. l. Order the pizza. l. Hang up. l. ELSE Forget the whole thing.
Selection Structure l Single Selection T F
Selection Structure. . . l Double Selection F T
Selection Structure. . . l Multiple Selection T F T F
Repetition (looping or iteration) l The program repeats the same instructions over and over. It is used when a set of actions is to be performed repeatedly.
Example l. DO gobble down pizza l. WHILE there is still pizza. Or l. DO gobble down pizza l. UNTIL none remains.
Repetition l While Structure T F
Repetition Structure. . . l For Structure T F
Repetition Structure. . . l Do/While Structure T F
Unconditional Branch l The program jumps from one place to another. Structured programming forbids this structure.
Program Development Life Cycle l A part of SDLC’s implementation phase and provides an organized plan for breaking down the task of program development into manageable chunks, each of which must be successfully completed before moving on to the next phase. l An outline of each of the steps used to build software applications.
1. Analyze: Define the problem. l Be sure you understand what the program should do. What the output should be – that is, exactly what the task should produce. l. Identify the data, or input, necessary to obtain the desired output. l. Determine how to process the input to obtain the desired output – that is, determine what formulas or ways of doing things can be used to obtain the output. l
2. Design: Plan the solution to the problem. l Develop the algorithm (a logical sequence of precise steps that solve the problem). Every detail, including obvious steps, should appear in the algorithm.
l Translate the algorithm into a logic plan using any of the popular methods – flowcharts, pseudocode, top-down charts. These design tools help the programmer break a problem into a sequence of small tasks the computer can perform to solve the problem. Planning also involves using representative data to test the logic of the algorithm by hand to ensure that it is correct.
3. Choose the interface: Select the objects (text boxes, command buttons etc. ) l Determine how the input will be obtained and how the output will be displayed. Then create objects to receive the input and display the output. Also, create appropriate command buttons and menus to allow the user to control the program. This step is used with Windows Application but
4. Code: Translate the algorithm/flowchart/pseudocod e into a programming language. l During this stage, the program is written in a particular language (e. g. , Visual Basic, C, Java) and entered into the computer. The programmer/coder uses the algorithm/flowchart/pseudocode devised in Step 2 along with a knowledge of the programming language, say, Visual Basic.
5. Test and debug. Locate and remove any errors in the program. l As the program is typed, some code editors point out certain types of program errors. Other types will detected by when the program is compiled ( or interpreted) and/or executed; however, many errors due to typing mistakes, flaws in the algorithm, or incorrect usages of the language rules can be uncovered and corrected only by careful detective work. An example of such an error would be using addition when multiplication
6. Complete the documentation: Organize all the material that describes the program. l Documentation is intended to allow another person, or the programmer at a later date, to understand the program. Internal documentation consists of statements in the program that are not executed, but point out the purposes of various parts of the program.
Documentation… l Documentation might also consist of a detailed description of what the program does and how to use the program (for instance, what type of input is expected).
Documentation… l For commercial programs, documentation includes an instruction manual and on-line help. Other types of documentation are the flowchart, pseudocode, and top-down chart that were used to construct the program. Although documentation is listed as the last step in the program development cycle, it should take place as the program is being coded.
Flowcharting Symbols
Some Application Flowcharting Symbols Card File Direct Access File Computer Program Document (such as hard copy from a computer system
Some Application Flowcharting Symbols… Display Multidocument Manual Input Preparation Manual Operation
Some Application Flowcharting Symbols… Punched Tape Collate Sort Extract
Some Application Flowcharting Symbols… Merge Sequential Access Storage Magnetic Disk Direct Access Storage
Application Flowcharting l The purpose of an application flowchart is to use symbols to give a general picture of what functions the computer system should perform. l It reveals how many program are to be written, what reports or documents are to be produced, and the form and source of the input data. l It gives an overall picture of the
Program Flowcharting Symbols
Documentation…
Documentation…
Example Problem l Suppose you are asked to determine the number of stamps to place on an envelop with the rule or policy that one stamp will be used for every five sheets of paper.
Problem Analysis
Program Design
Documentation…
Choosing the Interface l Form Layout
Properties Table
Properties Table…
Coding the Program
Coding the Program…
Coding the Program…
Coding the Program…
Coding the Program…
Problem l Given a street number of a one-way in New York, decide the direction of the street, either eastbound or westbound. Even-numbered streets run eastbound.
Thank you for listening!
Arrays
Array l An ordered set of values associated with a single variable name. –Shelly, Cashman, Dorin, Quasney l A list of data items that all have the same type and the same name. - Ferrel l A data structure whose elements are accessed by means of index positions. – Lambert & Osborne l. A collection of a fixed number of variables of the same data type or a list (or table) of variables of the type. - Goldstein
Declaring an Array l Arrays are declared in a variable declaration section. l General Syntax in C/C++ component type arrayname[size. N]…[size 1];
Dimension l The number of subscripts required to describe an array. The subscript or index is the item’s position in an array. It is an integer enclosed within the brackets (square or rounded).
Declaration Syntaxes l For One-Dimensional type array_name[size]; l For Two-Dimensional type array_name[rows][columns]; l For Three-Dimensional type array_name[pages][rows][columns];
Examples l double Department[7]; The component of this array are: Department[0] Department[1] Department[2] Department[3] Department[4] Department[5] Department[6]
l char Sign[25]; The components of this array are: Sign[0] Sign[1] Sign[2]. . . Sign[25]
typedef enum {Red, Green, Yellow} Traffic. Light; Traffic. Light Traffic[4]; The components are: Traffic[0] Traffic[1] Traffic[2] Traffic[3]
Assigning A Value to an Array l The components of an array may be assigned values just like any other variables. Examples: First. Visit[1] = Fri; Traffic[3]=Red; Department[5]=290. 12; Sign[24]=‘*’;
Initializing an Array l Syntax type-specifier array_name[size. N]…[size 1] = { value-list }
Examples l Int num[7] = {1, 2, 3, 4, 5, 6, 7} l char str[8]=“Laughter”; which is the same as l Char str[8]={‘L’, ’a’, ’u’, ’g’, ’h’, ’t’, ’e’, ’r’}
l int }; sqrs[7][2]= { 1, 1, 2, 4, 3, 9, 4, 16, 5, 25, 6, 36, 7, 49
Unsized-Array Initialization l char err 1[12]=“read errorn”; l char err 2[13]=“write errorn”; l char err 3[18]=“cannot open filen”; which is the same as, l char err 1[]=“read errorn”; l char err 2[]=“write errorn”; l char err 3[]=“cannot open filen”;
l int sqrs[][2]= { 1, 1, 2, 4, 3, 9, 4, 16, 5, 25, 6, 36, 7, 49 };
Logic l The grammar of correct thinking and reasoning. l Two Elements: l To think correctly and; l To reason out correctly. l If one of the elements would be missing, then no logic can be derived from. – Nilo M. Padre
Formulation l - An act or the product of formulating. Merriam Webster (http: //www. merriam -webster. com/dictionary/formulation) ● The act of creating something by thinking - The Free Dictionary (http: //www. thefreedictionary. com/for mulation)
- Why problem formulation follow goal formulation
- Logic formulation
- Plan formulation process in nepal
- Budget formulation process in nepal
- Strategy formulation process
- Strategy formulation process
- Policy formulation process
- First order logic vs propositional logic
- First order logic vs propositional logic
- First order logic vs propositional logic
- Combinational logic circuit vs sequential
- Tw
- Software development plan
- Is it x y or y x
- Combinational logic sequential logic 차이
- Logic chapter three
- Hình ảnh bộ gõ cơ thể búng tay
- Ng-html
- Bổ thể
- Tỉ lệ cơ thể trẻ em
- Chó sói
- Chụp phim tư thế worms-breton
- Bài hát chúa yêu trần thế alleluia
- Môn thể thao bắt đầu bằng từ chạy
- Thế nào là hệ số cao nhất
- Các châu lục và đại dương trên thế giới
- Công thức tính thế năng
- Trời xanh đây là của chúng ta thể thơ
- Cách giải mật thư tọa độ
- Phép trừ bù
- độ dài liên kết
- Các châu lục và đại dương trên thế giới
- Thơ thất ngôn tứ tuyệt đường luật
- Quá trình desamine hóa có thể tạo ra
- Một số thể thơ truyền thống
- Cái miệng nó xinh thế chỉ nói điều hay thôi
- Vẽ hình chiếu vuông góc của vật thể sau
- Biện pháp chống mỏi cơ
- đặc điểm cơ thể của người tối cổ
- V. c c
- Vẽ hình chiếu đứng bằng cạnh của vật thể
- Tia chieu sa te
- Thẻ vin
- đại từ thay thế
- điện thế nghỉ
- Tư thế ngồi viết
- Diễn thế sinh thái là
- Các loại đột biến cấu trúc nhiễm sắc thể
- Các số nguyên tố là gì
- Tư thế ngồi viết
- Lời thề hippocrates
- Thiếu nhi thế giới liên hoan
- ưu thế lai là gì
- Hổ sinh sản vào mùa nào
- Khi nào hổ con có thể sống độc lập
- Hệ hô hấp
- Từ ngữ thể hiện lòng nhân hậu
- Thế nào là mạng điện lắp đặt kiểu nổi
- The process of using logic to draw conclusions
- Role of hrm in strategy formulation
- Types of strategy formulation
- Spin finish oil formulation
- Descriptive research design
- Project formulation elements
- Process of portfolio management
- Product formulation statement
- Dose is defined as
- Product formulation statement
- Logic and computer design fundamentals
- An animal feed company must produce 200 kg of a mixture
- Lp model formulation example
- Advantages of linear programming
- Question formulation technique pdf
- Qft questioning