Program Design Introduction to Computer Programming By:

Slides:



Advertisements
Similar presentations
Repetition Control Structures
Advertisements

Repetition control structures
Programming Types of Testing.
Program Design Tool. 6 Basic Computer Operations Receive information Put out information Perform arithmetic Assign a value to variable (memory location)
TEL 104 / MKK Fundamental Programming: Lecture 3
Steps in Program Development
Chapter 2: Algorithm Discovery and Design
The Programming Discipline Professor Stephen K. Kwan 2010 Things you need to know (learn) for developing large computer programs.
Program Design and Development
16/27/ :53 PM6/27/ :53 PM6/27/ :53 PMLogic Control Structures Arithmetic Expressions Used to do arithmetic. Operations consist of +,
Algorithms. Introduction Before writing a program: –Have a thorough understanding of the problem –Carefully plan an approach for solving it While writing.
Pseudocode.
Chapter 1 Program Design
Pseudocode.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
DCT 1123 Problem Solving & Algorithms
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Simple Program Design Third Edition A Step-by-Step Approach
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
Developing an Algorithm
Selection Control Structures Simple Program Design Third Edition A Step-by-Step Approach 4.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
By the end of this session you should be able to...
Selection Control Structures. Simple Program Design, Fourth Edition Chapter 4 2 Objectives In this chapter you will be able to: Elaborate on the uses.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Developing an Algorithm
Mr. Dave Clausen1 La Cañada High School Chapter 6: Repetition Statements.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Chapter 2 Pseudocode. Objectives To introduce common words, keywords and meaningful names when writing pseudocode To define the three basic control structures.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Repetition Control Structures Simple Program Design Third Edition A Step-by-Step Approach 5.
Developing an Algorithm. Simple Program Design, Fourth Edition Chapter 3 2 Objectives In this chapter you will be able to: Introduce methods of analyzing.
Flow Control in Imperative Languages. Activity 1 What does the word: ‘Imperative’ mean? 5mins …having CONTROL and ORDER!
Introduction to Computer Programming using Fortran 77.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Pseudocode. Algorithm A procedure for solving a problem in terms of the actions to be executed and the order in which those actions are to be executed.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
Chapter 11 Describing Process Specifications and Structured Decisions
Control Structures II Chapter 3
Chapter 2: Input, Processing, and Output
GC211Data Structure Lecture2 Sara Alhajjam.
PROGRAM CONTROL STRUCTURE
The Selection Structure
Introduction To Flowcharting
Introduction to Algorithm – part 1
Computer Science Faculty
Algorithm and Ambiguity
CHAPTER 2 & 3: Pseudocode and Developing and Algorithm
Unit# 9: Computer Program Development
Selection CIS 40 – Introduction to Programming in Python
Pseudocode.
Pseudocode algorithms using sequence, selection and repetition
Algorithm Discovery and Design
Design and Implementation
Chapter 6: Repetition Statements
Problem Solving Skill Area 305.1
Algorithm and Ambiguity
Computer Science Core Concepts
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Chapter 11 Describing Process Specifications and Structured Decisions
Boolean Expressions to Make Comparisons
CHAPTER 4 Iterative Structure.
Flowcharts and Pseudo Code
Chapter 5 Desk Checking/Dry Running.
Introduction to Pseudocode
Presentation transcript:

Program Design Introduction to Computer Programming By: Mr. Baha Hanene

Learning Outcomes In this chapter we will cover L01 completely & L03. Discuss the features of a high-level language. (L01) Interpret pseudo code and describe its function. (L03)

Developing an Algorithm Contents Program Design Developing an Algorithm Solution Algorithm Pseudo Code Structure Theorem Conclusion

Program Design Definition: Employment of an algorithmic approach for the development of a solution to a problem, producing tested programs to meet given specifications PDL Program Design Language: A language, used for expressing program designs , that is similar to a conventional high-level programming language but emphasizes structure and intention rather than the ability to execute programs expressed in the language

Developing an Algorithm Defining a Problem: The problem should be divided into three different components. Input (A list of source data provided to the problem) Processing (A list of actions to be performed) Output ( The final outcome of the whole process) Naming a Variables: Be careful in using the name of variable it should have the following characteristics Self Explanatory Easy to Understand e.g. For Storing Dirhams the variable name could be Currency.

Solution Algorithm Designing a Solution Algorithm: This is the most challenging part of the program once you design a solid algorithm the rest problem remains nothing below are details Make a general sketch of the system Identify the control structures Try to have an understanding that how procession will take place Do not hesitate to alter or discard the algorithm Do not start coding in hurry Check the Solution Algorithm: After a solution algorithm is constructed it must be tested for correctness, as most logical errors occur during development.

Solution Algorithm Steps in Desk Checking an Algorithm Desk Checking the Algorithm: It involves tracing through the logic of the algorithm with some chosen test data. Selecting Test Data: Choose simple test cases only, based on the requirements of the specification, not the algorithm. Steps in Desk Checking an Algorithm There are six simple steps to follow in desk checking of an algorithm Choose simple input test cases which are valid. Establish what the expected results should be for each test case. Make a table of relevant variable names on a paper. Walk the first test case through the algorithm (Dry Run). Repeat the walk-through process using other test cases. Check that the expected results established in step 2 matches the actual result developed in step 5.

Pseudo Code How to write a pseudo code…? Each operation of a computer can be represented as a straight forward English instruction, with keywords and indentation to signify a particular control structure. Six Basic Computer Operations: A computer can receive information A computer can put out information A computer can perform arithmetic A computer can assign a value to a piece of data A computer can do comparison and then decision A computer can repeat a group of actions

Pseudo Code A computer can receive information: Typical pseudo-code instructions to receive information are: Read student name Get date Read number_1, number_2 Get tax_code A computer can put out information: Typical pseudo-code instructions to put out information are: Print “Program Completed” Write customer record to master file Put out name, address and postcode Output total_tax Display end_of_data

Structure Theorem The Structure Theorem? There are basically three control structures according to the structure theorem. The structure theorem states that “It is possible to write any computer program by using only three basic control structures that are easily represented in pseudo-code : Sequence Selection repetition. 1. Sequence Control Structure: It is the straight forward execution of one processing step after another, for example: statement a statement b statement c A typical sequence of statements in an algorithm: Add 1 to page_count Print heading line Set line_count to zero Read customer record

Structure Theorem 2. Selection Control Structure: It is the presentation of a condition and the choice between two actions, the choice depending on whether the condition is true or false. In pseudo- code the selection is represented by the Keyword IF, THEN and ELSE, for Example IF condition p is true THEN statement (s) in true case ELSE statement (s) in false case Null ELSE Structure: A task is performed only if a particular condition is true. The null ELSE Construct is written in pseudo-code as:

Structure Theorem 3. Repetition Control Structure: It can be defined as the presentation of a set of instructions to be performed repeatedly, as long as a condition is true. It means that “A block of statements is executed again and again, until a terminating condition occurs”. It is written in pseudo-code as: WHILE condition p is true { statement block } Example: Set student_total to zero WHILE student_total < 50 { Read student record Print student name and address Add 1 to student_total

Conclusion We can define what is an algorithm…? How to write and to deal with it …? What is a pseudo code …? What is a desk check …? What is structure theorem …? What is Sequence Control …? What is Selection Control …? What is Repetition Control …?