1 / 73

Logic Formulation

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.

Download Presentation

Logic Formulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Logic Formulation

  2. What is LogicFormulation? 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=20071110191353AABcdvH

  3. What is Logic Formulation? …. • 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

  4. Basic Control Structures (logical constructs that specify how instructions in a program are to be executed) • Sequence • Selection • Repetition • Unconditional Jump

  5. Sequence • 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.

  6. Example • Go to the phone • Dial the pizza place • Order the pizza • Hang up

  7. Sequence Structure

  8. Selection (conditional, branch, or decision) • 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 action is performed.

  9. Example Open your wallet • If you have enough money, • THEN Go to the phone. • Dial the pizza place. • Order the pizza. • Hang up. • ELSE Forget the whole thing.

  10. Selection Structure • Single Selection T F

  11. Selection Structure ... • Double Selection F T

  12. Selection Structure ... • Multiple Selection T F T F T F

  13. Repetition (looping or iteration) • The program repeats the same instructions over and over. It is used when a set of actions is to be performed repeatedly.

  14. Example • DO gobble down pizza • WHILE there is still pizza. Or • DO gobble down pizza • UNTIL none remains.

  15. Repetition • While Structure T F

  16. Repetition Structure ... • For Structure T F

  17. Repetition Structure ... • Do/While Structure T F

  18. Unconditional Branch • The program jumps from one place to another. Structured programming forbids this structure.

  19. Program Development Life Cycle • 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. • An outline of each of the steps used to build software applications.

  20. 1. Analyze: Define the problem. • Be sure you understand what the program should do. • What the output should be – that is, exactly what the task should produce. • Identify the data, or input, necessary to obtain the desired output. • 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.

  21. 2. Design: Plan the solution to the problem. • Develop the algorithm (a logical sequence of precise steps that solve the problem). Every detail, including obvious steps, should appear in the algorithm.

  22. 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.

  23. 3. Choose the interface: Select the objects (text boxes, command buttons etc.) • 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 not with Console Application.

  24. 4. Code: Translate the algorithm/flowchart/pseudocode into a programming language. • 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.

  25. 5. Test and debug. Locate and remove any errors in the program. • 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 was the proper operation.

  26. 6. Complete the documentation: Organize all the material that describes the program. • 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.

  27. Documentation… • 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).

  28. Documentation… • 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.

  29. Flowcharting Symbols

  30. Some Application Flowcharting Symbols Card File Direct Access File Computer Program Document (such as hard copy from a computer system

  31. Some Application Flowcharting Symbols… Display Multidocument Manual Input Preparation Manual Operation

  32. Some Application Flowcharting Symbols… Punched Tape Collate Sort Extract

  33. Some Application Flowcharting Symbols… Merge Sequential Access Storage Magnetic Disk Direct Access Storage

  34. Application Flowcharting • The purpose of an application flowchart is to use symbols to give a general picture of what functions the computer system should perform. • 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. • It gives an overall picture of the application.

  35. Program Flowcharting Symbols

  36. Documentation…

  37. Documentation…

  38. Example Problem • 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.

  39. Problem Analysis

  40. Program Design

  41. Documentation…

  42. Choosing the Interface • Form Layout

  43. Properties Table

  44. Properties Table…

  45. Coding the Program

  46. Coding the Program…

More Related