Problem-solving with Computers. 2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of.

Slides:



Advertisements
Similar presentations
CS101: Introduction to Computer programming
Advertisements

PROBLEM SOLVING TECHNIQUES
Chapter 2: Problem Solving
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
زبانهای برنامه سازی برنامه سازی پیشرفته ارائه دهنده دکتر سيد امين حسيني E.mail: Home page:
ITEC113 Algorithms and Programming Techniques
Chapter 2- Visual Basic Schneider
Program Design and Development
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
1414 CHAPTER PROGRAMMING AND LANGUAGES. © 2005 The McGraw-Hill Companies, Inc. All Rights Reserved Competencies Describe the six steps of programming.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
The Program Design Phases
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
Structured COBOL Programming, Stern & Stern, 9th edition
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
Simple Program Design Third Edition A Step-by-Step Approach
Designing and Debugging Batch and Interactive COBOL Programs Chapter 5.
Programming Concepts Chapter 3.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
CPS120 Introduction to Computer Programming The Programming Process.
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.
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.
1 Programming with MATLAB ผศ. ดร. อนันต์ ผลเพิ่ม Anan Phonphoem
Cs413_design04.ppt Design and Software Development Design : to create a functional interface that has high usability Development : an organized approach.
Control Structures CPS120: Introduction to Computer Science Lecture 5.
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.
Programming and Languages
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Chapter 14 Programming and Languages McGraw-Hill/Irwin Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Algorithms and Pseudocode
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
PROGRAMMING. Computer Programs  A series of instructions to the computer  pre-written/packaged/off-the-shelf, or  custom made  There are 6 steps to.
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.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
 Problem Analysis  Coding  Debugging  Testing.
Program design Program Design Process has 2 phases:
Chapter 2- Visual Basic Schneider
System Design.
Programming Fundamentals
Algorithm and Ambiguity
An Introduction to Visual Basic .NET and Program Design
ALGORITHMS AND FLOWCHARTS
Unit# 9: Computer Program Development
Problem Solving Techniques
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
Algorithms & Pseudocode & Flowcharts
Introduction to Algorithms and Programming
Chapter 2- Visual Basic Schneider
Algorithm and Ambiguity
Basic Concepts of Algorithm
Algorithms & Pseudocode & Flowcharts
Presentation transcript:

Problem-solving with Computers

2Outline  Computer System  5 Steps for producing a computer program  Structured program and programming  3 types of control structure  Algorithm  Tools for describing an algorithm  Examples of algorithm and programs

3 Computer System Software Hardware InputOutput  A Computer system is a collection of hardware and software.

4 Computer System  Hardware  the electric, electronic, and mechanical equipment that makes up a computer  Software  the series of instructions that tells the hardware how to perform tasks

5 Computer System  Hardware : requires a series of instructions to carry out its processing function.  Software : a group of instructions (computer program) which command a computer to take action and to make decision.  Without software, hardware is useless; hardware needs the instructions provides by software to process data into information.

6 Computer Program (Software)  A program is a sequence of instructions suitable for processing by a computer  Programs are written  for controlling the computer hardware oInstructions in a program tell the hardware to perform a task  for solving problems. Without software, the hardware doesn’t know what to do !!

7 Computer System  Algorithm  describe the method in a sequence of steps to get a computer to perform a task.  An Algorithm must be translated into a program by coding in a programming language.

8 Computer Program (Software)  The activities of expressing an algorithm of a problem and translating the algorithm as a program is called programming. The most fundamental concepts of computer science is programming and algorithm.

9 5 Major Steps for Producing a Computer Program  Problem Definition  Understanding the problem  Problem Design  Proposing the solution  Problem Coding  Implementing the solution  Problem Testing  Testing the solution  Problem Documentation  Writing the document

10 Problem Definition Problem Definition  Have a clear understanding the problem  What we want to do  specify objectives  specify the desired input and output

11 Problem Design Problem Design  Proposing the solution  Top-down design with modularity approach using hierarchy chart  Input/output and data structure design  Algorithm design with certain tools o Pseudocode o Flowchart

12 Problem Coding Problem Coding  Implementing the solution  Write (code) the program from algorithm by using selected programming language Program = Algorithm + Data Structure

13 Problem Testing Problem Testing  Testing the solution  Structured walk-through  Desk checking  Sample test data

14 Problem Documentation Problem Documentation  Writing the document  User documentation  Program documentation  Program Maintenance

15 Structure Program and Programming Structure Program and Programming  Technique for organizing and coding computer programs  Hierarchy of modules is used  Single entry  Single exit point  Control is passed downward through the structure without unconditional branches to higher levels of the structure

16 Structure Program and Programming Structure Program and Programming  Module  A self-contained activities that contributes a specific subtask.  The overall task is done in a logical order of the hierarchy of the subtasks.

17 Example of Top-down Design Example of Top-down Design (with Modularity approach using a hierarchy chart) Payroll System InputPayment ProcessingOutput Compute PayCompute Payroll Deduction Regular Pay Overtime Pay Payroll Saving Tax

18 Problem Solving with Computer Problem Solving with Computer Problem Solution in a computer program Solution in a algorithm form Difficult in solving big problem Problem solving phase Implementation phase

19 Structure Program and Programming Structure Program and Programming  3 types of control flow (structure)  Sequence  Selection or branching  Iteration or looping Explain on the blackboard

20 Sequence Sequence Statement #1 Statement #2 Statement #3 read X read Y Z = X + Y print (“The sum of X and Y is ”, Z)Example Statement #1 Statement #2 Statement #3

21 Selection Selection if condition then Statement #1 else Statement #2 condition Statement #2Statement #1 FalseTrue

22Selection read X read Y if then if ( X > Y ) then print (“ X is greater than Y”) else else print (“ Y is greater than X”)Example if condition then Statement #1 else Statement #2

23 Iteration (Repeat Loop) Iteration (Repeat Loop) repeat Statements until condition condition Statements False True

24 Iteration (Repeat Loop) Iteration (Repeat Loop) repeat Statements until condition read X read Y repeat repeat print X X = X+1 until until (X >Y)Example

25 Iteration (While Loop) Iteration (While Loop) while condition do Statements condition Statements False True

26 Iteration (While Loop) Iteration (While Loop) read X read Y while while (X<=Y) do do print X X = X+1Example while condition do Statements

27 Iteration (For Loop) for i = 1 to n do Statements i <= n Statements False 1  i i = i + 1 True

28 Iteration (For Loop) for i = 1 to n do Statements read X read Y for for i = 1 to X do do print (“The value of i is ”, i) Example