Problem Solving.

Slides:



Advertisements
Similar presentations
An Introduction to Programming with C++ Fifth Edition
Advertisements

An Introduction to Programming with C++ Fifth Edition Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Programming Types of Testing.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
Chapter 2- Visual Basic Schneider
Defining Control Structures
Chapter 3 Planning Your Solution
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Planning for the Solution
Computer Programming TCP1224 Chapter 2 Beginning the Problem-Solving Process.
Chapter 2: Beginning the Problem-Solving Process
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
CPS120 Introduction to Computer Programming The Programming Process.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
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.
An Introduction to Programming with C++ Sixth Edition
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
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.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
An Introduction to Programming with C++1 Beginning the Problem- Solving Process Tutorial 2.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 1 An Introduction to Visual Basic.NET and Program Design.
Your Interactive Guide to the Digital World Discovering Computers 2012 Chapter 13 Computer Programs and Programming Languages.
An Introduction to Programming with C++ Sixth Edition Chapter 8 More on the Repetition Structure.
CMSC 104, Version 8/061L05Algorithms2.ppt Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode Control Structures Reading Section 3.1.
ICS 3UI - Introduction to Computer Science
Chapter 8: More on the Repetition Structure
More on the Selection Structure
Software Development Expansion of topics page 28 in Zelle
An Introduction to Programming with C++ Sixth Edition
Exam 1 Review.
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
Chapter 2: Input, Processing, and Output
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
The Selection Structure
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.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
UMBC CMSC 104 – Section 01, Fall 2016
Algorithm and Ambiguity
An Introduction to Visual Basic .NET and Program Design
An Introduction to Programming with C++ Fifth Edition
Chapter 1 Program Development
Unit# 9: Computer Program Development
Introduction to Algorithms
2008/09/22: Lecture 5 CMSC 104, Section 0101 John Y. Park
An Introduction to Structured Program Design in COBOL
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Chapter 2- Visual Basic Schneider
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Algorithm and Ambiguity
Click to add Text Computers & Instructions. Computers are given instructions in the form of computer programs that are created through the development.
Flowcharts and Pseudo Code
Chapter 1 Problem Solving with C++
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
An Introduction to Programming with C++ Fifth Edition
Chapter 2: Input, Processing, and Output
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Review of Previous Lesson
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Programming Logic and Design Eighth Edition
Presentation transcript:

Problem Solving

Objectives Explain the problem-solving process used to create a computer program Analyze a problem Complete an IPO chart Plan an algorithm using pseudocode and flowcharts Desk-check an algorithm An Introduction to Programming with C++, Fifth Edition

Solving Everyday Problems First step in solving a problem: analyze it E.g., problem of being hungry Next, you plan, review, implement, evaluate, and modify (if necessary) the solution E.g., if you are still hungry An Introduction to Programming with C++, Fifth Edition

You Do It… You are hungry… Develop a plan to solve the issue Do not worry about money Assume that you have any ingredients that you might need

Solving Everyday Problems (continued) An Introduction to Programming with C++, Fifth Edition

Solving Everyday Problems (continued) An Introduction to Programming with C++, Fifth Edition

Creating Computer Solutions to Problems Analysis tools: IPO charts, pseudocode, flowcharts To desk-check or hand-trace, use pencil, paper, and sample data to walk through algorithm A coded algorithm is called a program An Introduction to Programming with C++, Fifth Edition

Creating Computer Solutions to Problems (continued) An Introduction to Programming with C++, Fifth Edition

Analyzing the Problem Analyze a problem to: Determine the goal of solving it Output Determine the items needed to achieve that goal Input Always search first for the output An Introduction to Programming with C++, Fifth Edition

Analyzing the Problem (continued) An Introduction to Programming with C++, Fifth Edition

IPO Charts Use an IPO chart to organize and summarize the results of a problem analysis IPO: Input, Processing, and Output An Introduction to Programming with C++, Fifth Edition

IPO Charts (continued) An Introduction to Programming with C++, Fifth Edition

IPO Charts (continued) An Introduction to Programming with C++, Fifth Edition

Analyzing the Problem (continued) First, reduce the amount of information you need to consider in your analysis: An Introduction to Programming with C++, Fifth Edition

Analyzing the Problem (continued) Worse than having too much information is not having enough information to solve problem: An Introduction to Programming with C++, Fifth Edition

Analyzing the Problem (continued) Distinguish between information that is missing and information that is implied: An Introduction to Programming with C++, Fifth Edition

Planning the Algorithm Algorithm: set of instructions that will transform the problem’s input into its output Record it in the Processing column of the IPO chart Processing item: intermediate value used by algorithm when processing input into output Pseudocode is a tool programmers use to help them plan an algorithm Short English statements An Introduction to Programming with C++, Fifth Edition

Planning the Algorithm (continued) An Introduction to Programming with C++, Fifth Edition

Planning the Algorithm (continued) A problem can have more than one solution: An Introduction to Programming with C++, Fifth Edition

Hints for Writing Algorithms This problem specification is almost identical to the one shown earlier in Figure 2-4 An Introduction to Programming with C++, Fifth Edition

Hints for Writing Algorithms (continued) You may use a portion of a previous solution to solve current problem An Introduction to Programming with C++, Fifth Edition

Desk-Checking the Algorithm An Introduction to Programming with C++, Fifth Edition

Desk-Checking the Algorithm (continued) An Introduction to Programming with C++, Fifth Edition

Desk-Checking the Algorithm (continued) Valid data is data that the programmer is expecting the user to enter Invalid data is data that he or she is not expecting the user to enter You should test an algorithm with invalid data Users may make mistakes when entering data An Introduction to Programming with C++, Fifth Edition

The Gas Mileage Problem An Introduction to Programming with C++, Fifth Edition

The Gas Mileage Problem (continued) After planning the algorithm, you desk-check it: An Introduction to Programming with C++, Fifth Edition

Summary Problem-solving typically involves analyzing the problem, and then planning, reviewing, implementing, evaluating, and modifying (if necessary) the solution Programmers use tools (IPO charts, pseudocode, flowcharts) to help them analyze problems and develop algorithms During analysis, you determine the output and input During planning, you write the steps that will transform the input into the output An Introduction to Programming with C++, Fifth Edition

Summary (continued) After the analysis and planning, you desk-check the algorithm Follow each of the steps in algorithm by hand Coding refers to translating the algorithm into a language that the computer can understand Before writing an algorithm, consider whether you have already solved a similar problem An Introduction to Programming with C++, Fifth Edition

Application Lesson: Using the First Steps in the Problem-Solving Process Practice Page 78 John Lee wants a program that allows him to enter the following three pieces of information: his checking account balance at the beginning of the month, the amount of money he deposited during the month, and the amount of money he withdrew during the month. He wasn’t the program to display his balance at the end of the month. Page 78 # 3 & 4 Type them in Word and turn in. You have 15 minutes An Introduction to Programming with C++, Fifth Edition