A power Point Presentation for Program Logic Formulation.
Size: 2.65 MB
Language: en
Added: Aug 30, 2024
Slides: 41 pages
Slide Content
Program Logic Formulation
What is PLF
Program Logic Formulation The Program Logic Formulation are instructions in a program set in a proper order to solve a problem. Provide a set of requirements to five programmers, and each may build different program logic.
Logic A system or set of principles underlying the arrangements of elements in a computer or electronic device so as to perform a specified task.
Mathematical Logic Logic means reasoning. The reasoning may be a legal opinion or mathematical confirmation. We apply certain logic in Mathematics. Basic Mathematical logics are a negation, conjunction, and disjunction. The symbolic form of mathematical logic is, ‘~’ for negation ‘^’ for conjunction and ‘ v ‘ for disjunction.
System A set of things working together as parts of a mechanism or an interconnecting network; a complex whole.
Process of PLF
Process Program Design Development Implementation Documentation Review
Process Program Design Development Implementation Documentation Review
Program Design Flowcharts
What is Flowchart? A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task. The flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes with arrows. This diagrammatic representation illustrates a solution model to a given problem. Flowcharts are used in analyzing, designing, documenting or managing a process or program in various fields.
Examples Flowchart
Example 1 Sarah Cruz has been working for COMPUTER Z Company for four years. Last year, Sarah received a 5% raise, which brought her current monthly pay to 25,000.00 pesos. Sarah is scheduled to receive a 4% raise next month. She wants to write a program that will display, on the computer screen, the amount of her new monthly pay.
Example 2 A student took four quizzes in a term and would like to compute their average. He also would like to know if the average has a passing mark. Note that grade lower than 75% is failed.
Program Design Psuedocode
What is Pseudocode Pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine reading. It typically omits details that are essential for machine understanding of the algorithm, such as variable declarations and language-specific code. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications to document algorithms and in planning of software and other algorithms.
Examples Psuedocodes
Example 1 Sarah Cruz has been working for COMPUTER Z Company for four years. Last year, Sarah received a 5% raise, which brought her current monthly pay to 25,000.00 pesos. Sarah is scheduled to receive a 4% raise next month. She wants to write a program that will display, on the computer screen, the amount of her new monthly pay. Begin Int BaseNum , Percnt,Result , BasePrcnt ; Input BaseNum ; Input Percnt ; BasePrcnt = Percnt / 100; Result = BaseNum * BasePrcnt ; Output “The New Salary is “ . Result; End
Example 2 A student took four quizzes in a term and would like to compute their average. He also would like to know if the average has a passing mark. Note that grade lower than 75% is failed. Start int score1, score2, score3, score4, Average, SumAve ; Input score1; Input score2; Input score3; Input score4; SumAve = score1+score2+score3+score4; Average = SumAve / 4; If (Average >= 75) { Output “The Average is “ . Average; Output “ You are passed.” } Else { Output “The Average is “ . Average; Output “You are failed.” } End
Program Design Conditional statements
Conditional Statements Conditionals are programming language commands for handling decisions. Specifically, conditionals perform different computations or actions depending on whether a programmer-defined boolean condition evaluates to true or false.
Example 2 A student took four quizzes in a term and would like to compute their average. He also would like to know if the average has a passing mark. Note that grade lower than 75% is failed.
Example 2 A student took four quizzes in a term and would like to compute their average. He also would like to know if the average has a passing mark. Note that grade lower than 75% is failed.
Example 2 A student took four quizzes in a term and would like to compute their average. He also would like to know if the average has a passing mark. Note that grade lower than 75% is failed. Start int score1, score2, score3, score4, Average, SumAve ; Input score1; Input score2; Input score3; Input score4; SumAve = score1+score2+score3+score4; Average = SumAve / 4; If (Average >= 75) { Output “The Average is “ . Average; Output “ You are passed.” } Else { Output “The Average is “ . Average; Output “You are failed.” } End
Example 2 A student took four quizzes in a term and would like to compute their average. He also would like to know if the average has a passing mark. Note that grade lower than 75% is failed. Start int score1, score2, score3, score4, Average, SumAve ; Input score1; Input score2; Input score3; Input score4; SumAve = score1+score2+score3+score4; Average = SumAve / 4; If (Average >= 75) { Output “The Average is “ . Average; Output “ You are passed.” } Else { Output “The Average is “ . Average; Output “You are failed.” } End
Program Design Loopings
What is Looping Looping statement are the statements execute one or more statement repeatedly several number of times. In Java programming language there are three types of loops; while, for and do-while.
For loop For loop is a control flow statement for specifying iteration, which allows code to be executed repeatedly.
While loop The while loop is used to repeat a section of code an unknown number of times until a specific condition is met. For example, say we want to know how many times a given number can be divided by 2 before it is less than or equal to 1.
Do while loop A do while loop is a control flow statement that executes a block of code at least once, and then either repeatedly executes the block, or stops executing it, depending on a given boolean condition at the end of the block.
Program Design Operators
What is operators operators are constructs defined within programming languages which behave generally like functions, but which differ syntactically or semantically. Common simple examples include arithmetic (e.g. addition with +), comparison (e.g. "greater than" with >), and logical operations (e.g. AND, also written && in some languages). More involved examples include assignment (usually = or:=), field access in a record or object (usually.), and the scope resolution operator (often:: or.). Languages usually define a set of built-in operators, and in some cases allow users to add new meanings to existing operators or even define completely new operators.