2.0 Problem Solving PROGRAM DESIGN

Slides:



Advertisements
Similar presentations
PSEUDOCODE & FLOW CHART
Advertisements

UNIT 2. Introduction to Computer Programming
Chapter 1 - An Introduction to Computers and Problem Solving
Subject: Information Technology Grade: 10
Reference :Understanding Computers
ME 142 Engineering Computation I Fundamentals of Procedural Computer Programming.
Fundamentals of Algorithms MCS - 2 Lecture # 4
INTRODUCTION TO PROGRAMMING
 Control structures  Algorithm & flowchart  If statements  While statements.
ITEC113 Algorithms and Programming Techniques
Chapter 3 Planning Your Solution
The Program Design Phases
Review Algorithm Analysis Problem Solving Space Complexity
PRE-PROGRAMMING PHASE
Chapter 1 Pseudocode & Flowcharts
Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney.
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
C++ If….Else Statements and Flowcharts October 10, 2007.
Programming Concepts Chapter 3.
Lecture 2: Logical Problems with Choices. Problem Solving Before writing a program Have a thorough understanding of the problem Carefully plan an approach.
Program Planning and Design. What is Program Planning and Design? Program planning and design is simply knowing what you want to do and how you want to.
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
Program Design BUILDING A HOUSE. Steps to Designing a Program 1. Define the Output 2. Develop the logic to get that output 3. Write the program.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
1 Program Planning and Design Important stages before actual program is written.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Topics: Selection Statements. Processing Involving Selecting Instructions An instruction that allows deviation and selection to take place uses the ‘IF’
ICS124 Session 9 Flowcharting 1. By the end of this section the student will be able to:  Name the three structures of the Structure Theorem  Identify.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Pseudocode (pronounced SOO-doh-kohd)  is a detailed yet readable description of what a computer program or algorithm must do, expressed in a formally-styled.
Basics of Computer A Computer is Electronic device that can
Algorithm: procedure in terms of
Flow Charts Basic Flow Chart Symbols Few sample flowcharts Rules
Lesson 2 Flowcharting.
Programming Languages
Chapter One Problem Solving
Chapter 2- Visual Basic Schneider
Introduction to Computing
Algorithms and Flowcharts
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Lecture 2 Introduction to Programming
Introduction To Flowcharting
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Numbering System TODAY AND TOMORROW 11th Edition
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
Each instruction on a separate line
Lecture 2: Logical Problems with Choices
Chapter 1 Pseudocode & Flowcharts
Unit# 9: Computer Program Development
Problem Solving Techniques
Program Control using Java - Theory
PROBLEM SOLVING CSC 111.
Structured Program
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Faculty of Computer Science & Information System
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
Understanding Problems and how to Solve them by using Computers
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Basic Concepts of Algorithm
WJEC GCSE Computer Science
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Introduction to Programming
Structure Charts.
Presentation transcript:

2.0 Problem Solving PROGRAM DESIGN Prepared by : Pn Nurul Zakiah Binti Kasnun @ IT Department

STEP 2: PROGRAM DESIGN Definition: It is a framework or flow that shows the steps in problem solving. Methods to design a program: Pseudocode Flowchart Structure Chart IPO Chart

Pseudocode Steps in problem solving that is written half in programming code and half in human language. For example, some part uses C language code and some part uses Malay or English language. Advantages: Easily understood. Easily maintained. The codes are changeable. Disadvantages: Cannot be executed in the computer.

Example: START Total=0, Average=0 Input a, b, c Total = a + b + c Average = Total / 3 Output a, b, c Output Average END

Flowchart A graphical representation of data, information and workflow using certain symbols that are connected to flow lines to describe the instructions done in problem solving. It shows the flow of the process from the start to the end of the problem solving.

Enter data from keyboard Calculate total Display data and total Flowchart Explanation Enter data from keyboard Calculate total Display data and total START Input Process Output END

Explanation of basic flowchart symbol: Simbol / Symbol Penerangan / Explanation Indicate the direction of data flow. Used to connect a block to another block. Indicates operations / process involved. Receive / read value Display value Execute decision based on condition. Test is performed and the program flow continues, based on the result. Indicates the beginning and end of a flowchart. Show the continuing flowchart in the same page. Flow Lines Process Input / Output Decision Start / End Flow Lines On-page connector Flow Lines

Symbol usage START True Condition True Statement False False statement Input Condition False statement Output END False True Statement True Symbol usage

Cont…Explanation of basic flowchart symbol: Output END B START Input Process First page Next page Symbol Usage Symbol Explanation Flowchart continues in the next page. Off Page Connector

There are few additional symbols of flowchart used in a complicated program: GOSUB and RETURN. It’s usually used in a big program. Symbol Explanation Instruct the executed instruction to move to the next function Instruct the executed instruction to return to the next instruction after the GOSUB instruction, called the function. GOSUB RETURN

area =22 / 7 * radius * radius Output area area RETURN Input radius START END GOSUB area Symbol Usage

Example Flowchart: Flowchart to calculate the total of fine for late returning of library books. START Input total_of_day Fine = total_of_day * 0.20 Output Fine END Symbol Usage

Structure Charts Structure chart is an additional method in preparing programs that has many sub modules. It consists rectangular boxes, which represents all the sub modules in a program and is connected by arrows. It illustrates the top-down design of a program and is also known as hierarchical chart because its components are in hierarchical form. The advantage is that it is easy to be drawn and to be changed. Format: MainModule SubModule 2 SubModule 3 SubModule 1 SubModule 2.1 SubModule 2.2

Problem: To calculate the amount of water bill Example 1: Problem: To calculate the amount of water bill Represent the modules in the program Water bill Get / read data Compute the charge Display instructions for user Determine the late charge Display the bill Print the bill

Represent the modules in the program Display instructions for user Example 2: Problem: To calculate area of a circle Represent the modules in the program Area of a circle Get / read data Compute the area Display instructions for user Define the area Display the area Print the area

IPO Chart (Input Process Output) Module Reference No. Output All inputs All Process Module Reference No. from structure chart All outputs

Example : Calculate the Salary of Employee Input Process Module Reference No. Output Hour Pay rate Start Enter hour Enter pay rate Calculate salary Display salary End 0000 1000 2000 3000 Salary 0000