Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6.

Slides:



Advertisements
Similar presentations
Repetition Control Structures
Advertisements

Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2- Visual Basic Schneider
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Program Design and Development
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
Basic Building Blocks of Programming. Variables and Assignment Think of a variable as an empty container Assignment symbol (=) means putting a value into.
Chapter 2: Algorithm Discovery and Design
Repetition Control Structures
Pseudocode.
General Algorithms for Common Business Problems
Chapter 1 Program Design
Pseudocode Algorithms Using Sequence, Selection, and Repetition.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Pseudocode.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
Combination of Sequence, Selection and Repetition
Pseudocode algorithms using sequence, selection and repetition
DCT 1123 Problem Solving & Algorithms
Simple Program Design Third Edition A Step-by-Step Approach
Chapter 5: Control Structures II (Repetition)
CHAPTER 5: CONTROL STRUCTURES II INSTRUCTOR: MOHAMMAD MOJADDAM.
Array Processing Simple Program Design Third Edition A Step-by-Step Approach 7.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Program Design Simple Program Design Third Edition A Step-by-Step Approach 9.
First Steps in Modularization Simple Program Design Third Edition A Step-by-Step Approach 8.
Developing an Algorithm
Selection Control Structures Simple Program Design Third Edition A Step-by-Step Approach 4.
Chapter 7 Array processing. Objectives To introduce arrays and the uses of arrays To develop pseudocode algorithms for common operations on arrays To.
Array Processing.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
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
Chapter 2 Problem Solving On A Computer 2.1 Problem Solving Steps Solving a problem on a computer requires steps similar to those followed when solving.
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
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.
General Algorithms for Common Business Problems Simple Program Design Third Edition A Step-by-Step Approach 10.
Pseudocode Algorithms Using Sequence, Selection, and Repetition
Repetition Control Structures Simple Program Design Third Edition A Step-by-Step Approach 5.
EXERCISES for ALGORITHMS WRITING
Basic problem solving CSC 111.
Developing an Algorithm. Simple Program Design, Fourth Edition Chapter 3 2 Objectives In this chapter you will be able to: Introduce methods of analyzing.
Cosc175 - Define Problem/Design Solution/Pseudocode/Trace 1 DEFINE THE PROBLEM.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
CSC 111. Solving Problems with Computers Java Programming: From Problem Analysis to Program Design, Third Edition3 Solving Problems Stages 1.Problem.
Computer Programming CONTENTS Introduction to Operating Systems Introduction to programming languages Introduction to perl programming language Programming.
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.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
An Introduction to Programming with C++ Sixth Edition Chapter 8 More on the Repetition Structure.
Further Modularization, Cohesion, and Coupling. Simple Program Design, Fourth Edition Chapter 9 2 Objectives In this chapter you will be able to: Further.
Chapter 2: Input, Processing, and Output
Chapter 2- Visual Basic Schneider
Pseudocode algorithms using sequence, selection and repetition
MSIS 655 Advanced Business Applications Programming
Chapter 2- Visual Basic Schneider
Chapter 2- Visual Basic Schneider
CHAPTER 4 Iterative Structure.
Presentation transcript:

Pseudocode Algorithms Using Sequence, Selection, and Repetition Simple Program Design Third Edition A Step-by-Step Approach 6

Objectives To develop solution algorithms to eight typical programming problems using sequence, selection, and repetition constructs 6

Eight Solution Algorithms All the algorithms will use a combination of sequence, selection, and repetition constructs The algorithms have been designed to be interactive or to process sequential files (a) Defining the problem It is extremely important that you divide the problem into its three components: input, output, and processing 6

Eight Solution Algorithms (b) The control structures required Once the problem has been defined, write down the control structures (sequence, selection, and repetition) that may be needed, as well as any extra variables which the solution may require (c) The solution algorithm Having defined the problem and determined the required control structures, devise a solution algorithm and represent it using pseudocode 6

Eight Solution Algorithms Each solution algorithm presented in this chapter is only one solution to the particular problem: many different solutions could be equally correct (d) Desk checking You will need to desk check each of the algorithms with two or more test cases 6

Example 6.1 Process Number Pairs Design an algorithm that will prompt for and receive pairs of numbers from an operator at a terminal and display their sum, product, and average on the screen. If the calculated sum is over 200, an asterisk is to be displayed beside the sum A Defining diagram (see figure at top of page 70 in the textbook) 6

Example 6.1 Process Number Pairs B Control structures required 1.A DOWHILE loop to control the repetition 2.An IF statement to determine if an asterisk is to be displayed 3.Note the use of the NOT operand with the AND logical operator C Solution algorithm Refer to the algorithm written on page 70 of the textbook 6

Summary The approach to all of the problems followed the same path: 1.The problem was defined using a defining diagram 2.The control structures required were written down, along with any extra variables required 3.The solution algorithm was produced using pseudocode and the three basic control structures The solution algorithms mostly followed the same basic pattern 6