Lecture Notes 8/30/05 Program Design & Intro to Algorithms.

Slides:



Advertisements
Similar presentations
Chapter 1 - An Introduction to Computers and Problem Solving
Advertisements

Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
INTRODUCTION TO PROGRAMMING
ITEC113 Algorithms and Programming Techniques
Chapter 2- Visual Basic Schneider
Chapter 6 - Repetition. Introduction u Many applications require certain operations to be carried out more than once. Such situations require repetition.
Program Design and Development
Program Flow Charting How to tackle the beginning stage a program design.
Program Flow Charting How to tackle the beginning stage a program design.
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Chapter 1 Program Design
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
6 Steps of the Programming Process
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
Sw development1 Software Development 1.Define the problem (Analysis) 2.Plan the solution 3.Code 4.Test and debug 5.Maintain and Document.
Pseudocode algorithms using sequence, selection and repetition
Simple Program Design Third Edition A Step-by-Step Approach
Programming Lifecycle
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
Developing an Algorithm
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
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 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Chapter 1 Program design Objectives To describe the steps in the program development process To introduce the current program design methodology To introduce.
Chapter 2: General Problem Solving Concepts
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
Lecture 11: 10/1/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
Cosc175 - Define Problem/Design Solution/Pseudocode/Trace 1 DEFINE THE PROBLEM.
Introduction to programming Carl Smith National Certificate Year 2 – Unit 4.
Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
The Hashemite University Computer Engineering Department
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Lecture Notes 1/20/05 Pseudocode.  Pseudocode standard which we will follow in this class: - Statements are written in simple English; - Each instruction.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
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.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
| MSC 8102:PROGRAMMING CONCEPTS By Vincent Omwenga, PhD. 1.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
CSCI-235 Micro-Computer Applications
Chapter 2- Visual Basic Schneider
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.
Unit# 9: Computer Program Development
Problem Solving Techniques
Pseudocode algorithms using sequence, selection and repetition
Lecture Notes 8/24/04 (part 2)
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
Chapter 2- Visual Basic Schneider
Problem Solving Skill Area 305.1
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
Presentation transcript:

Lecture Notes 8/30/05 Program Design & Intro to Algorithms

Important Links   WebCT –

Homework for Thursday  Login to WebCT. Picture. Introduction.  Download a copy of the syllabus and read it.  Write an algorithm for a problem from class.  Read Chapter 1 in “C++ Programming”.  Read Chapters 1 – 3 in “Simple Program Design”

Main Objectives of This Course  Develop problem solving skills  Learn to program using C++

Algorithms * Informally - a general method for solving a problem; a recipe. * Our book - a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time. *According to Webster.. al.go.rithm - a rule or procedure for solving a mathematical problem that frequently involves repetition of an operation.

Program Development  Define the problem  Outline the solution  Develop the outline into an algorithm  Test the algorithm for correctness  Code the algorithm into a specific programming language  Run the program on the computer – test and debug  Document and maintain the program

Algorithms  Algorithm is required to be: * Well defined -- it is clearly and unambiguously specified. * Effective -- its steps are executable. * Finite -- it terminates after a bounded number of steps. * Must produce a correct solution 100% of the time.

Steps in Program Development 1. Define the problem Input Processing Output

Steps in Program Development 2. Outline the solution This is a rough draft of the solution. The outline may include:  Major processing steps involved.  Major subtasks  Major Control Structures  Major variables and record structures  The mainline logic.

“Find an average of 3 numbers” Outline - obtain three numbers from the user - calculate the average - display the result

Steps in Program Development 3. Develop an outline into an algorithm The algorithm represents the precise steps to be taken and the order in which they are to be carried out.

“Find an average of 3 numbers” Algorithm: Prompt user for 3 numbers Prompt user for 3 numbers Get 3 numbers Get x, y and z Add numbers together OR Sum = x+y+z Divide the sum by 3 Average = sum/3 Display the result Display Average

Steps in Program Development 4. Test the algorithm for correctness  Very important step!!  Check for logical errors, create test data and test your algorithm.

“Find an average of 3 numbers” Test Algorithm (Desk check or Trace): Get 3 numbers Add numbers together Divide the sum by 2 Display the result

Steps in Program Development 5. Code the algorithm into a specific programming language  C,  C++,  Java,  Fortran,  Cobol,  Basic,  etc…

“Find an average of 3 numbers” C++ (code segment): ….. cout<<“Enter three numbers”: cin >> x >> y >> z; sum = x+y+z; avg = sum/3.0; cout<< “The average is “<< avg; …..

Steps in Program Development 6. Run the program on a computer – test and debug The most fun and the most frustrating part of the program development. Two main types of errors:  Syntax errors (the program will not run)  Logic errors (the program will run but will not produce correct results)

Steps in Program Development 7. Document and maintain the program This is NOT the last step. You should document throughout the process of developing your program.  External documentation (algorithm, test data, etc…)  Internal documentation (commenting your code)

“Find the average of 3 numbers for 4 sets of data.”  Define the problem  Outline the solution  Develop the outline into an algorithm  Test the algorithm for correctness

Structured Programming Top down development:  Look at the problem as a whole  Outline general solution  Break down into main components  Functional decomposition This systematic, disciplined approach to program design results in a higher precision of programming.

Structured Programming Structure Theorem Any computer program can be written using the following three control structures: * Sequence * Selection (If-Then-Else) * Repetition (DoWhile)

Pseudocode  Pseudocode standard which we will follow in this class: - Statements are written in simple English; - Each instruction is written on a separate line; - Each set of instructions is written from top to bottom, with only one entry and one exit; - Groups of statements may be formed into modules, and that group given a name.