The Development Process Problem Solving. Problem Solving - Dr. Struble 2 What Is Asked of Computer Programmers? Input Transformation Output Write a computer.

Slides:



Advertisements
Similar presentations
Problem Solving and Algorithm Design
Advertisements

1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Overview of Programming and Problem Solving ROBERT REAVES.
Programming Types of Testing.
Chapter 1. The Phases of Software Development. Data Structure 2 Chapter outline  Objectives  Use Javadoc to write a method’s complete specification.
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Chapter 2 - Problem Solving
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Chapter 10 Algorithmic Thinking. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Learning Objectives List the five essential.
Overview. What is Computer Programming? It is the process of planning a sequence of steps (called instructions) for a computer to follow. 2 STEP 1 STEP.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
1 ICS103 Programming in C Lecture 3: Introduction to C (2)
CSE123 Introduction to Computing Lecture 1 Introduction Engineering Problem Solving.
Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Chapter 1 Introduction to Object- Oriented Programming and Problem Solving.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Programming Fundamentals (750113) Ch1. Problem Solving
1 Chapter 2 Problem Solving Techniques INTRODUCTION 2.2 PROBLEM SOLVING 2.3 USING COMPUTERS IN PROBLEM SOLVING : THE SOFTWARE DEVELOPMENT METHOD.
BPC.1 Basic Programming Concepts
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 3P. 1Winter Quarter Structured Engineering.
CS1044 – Intro. To Programming in C++ Dr. Craig A. Struble.
CS 115 Chapter 1 Overview of Programming and Problem Solving.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Chapter 2: Problem Solving
1 Chapter 1 Overview of Programming and Problem Solving Dale/Weems Slides based on work by Sylvia Sorkin, Community College of Baltimore County - Essex.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Chapter 2: Problem Solving
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
หลักการโปรแกรม เพื่อแก้ปัญหาโดยใช้คอมพิวเตอร์
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman CPCS 202 Chapter 2 – Input/Output
General Programming Introduction to Computing Science and Programming I.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
CS 1308 Computer Literacy and The Internet Software.
What is programming? Steps to solve a problem. Repeatable by executing or “doing” the steps again. UWP - Landgraf Some slides are from Dr. Qi Yang's notes.
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.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman Chapter 1 (Software Development Method) © CPCS
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Procedural Programming. Programming Process 1.Understand the problem 2.Outline a general solution 3.Decompose the general solution into manageable component.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
What's The Plan? Algorithmic Thinking Step-by-step directions for whatever someone, or the computer, needs to do © 2004 Lawrence Snyder.
2. Program Development Intro Programming in C++ Computer Science Dept Va Tech August 2001 ©2001 Barnette ND & McQuain WD 1 Top-Down Design:A solution method.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 3P. 1Winter Quarter Structured Engineering Problem Solving and Logic.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
1. Introduction Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 1 Algorithm:a finite set of instructions.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Chapter 10 Algorithmic Thinking. Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the.
The Hashemite University Computer Engineering Department
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Programming Fundamentals Introduction to Problem Solving  Programming is a problem solving activity. When you write a program, you are actually writing.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
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.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
CS 1044 Introduction to Programming in C/C++. Hi, My Name is… David McPherson David McPherson 625 McBryde Hall 625 McBryde Hall
DDC 1023 – Programming Technique
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Problem Solving Techniques
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Programming.
Understanding Problems and how to Solve them by using Computers
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Presentation transcript:

The Development Process Problem Solving

Problem Solving - Dr. Struble 2 What Is Asked of Computer Programmers? Input Transformation Output Write a computer program to perform the transformation Input is information to process. Output is the result of the transformation.

Problem Solving - Dr. Struble 3 Programming Process Problem Solving Phase Analysis and Specification General solution Verification Implementation Phase Concrete Solution Test Identify new features, bugs

Problem Solving - Dr. Struble 4 Computer Program Development Natural Language Compile/Link Ponder Does anything happen in between?

Problem Solving - Dr. Struble 5 From Natural Language to C++ Organize thoughts Clearly identify the input Clearly identify the output Identify the steps to transform the input to the output. – May require refinement

Problem Solving - Dr. Struble 6 Fundamental Goal in Programming Goal: Develop an algorithm for solving the problem. Definition of algorithm – A finite sequence of precise steps needed to solve a problem or perform a task. Written in natural language – Use unambiguous words to describe each step.

Problem Solving - Dr. Struble 7 Properties of Algorithms Finiteness – It has to finish at some point Absence of ambiguity – Only one interpretation Sequence – Need to know the order of execution Input/Output – 0 or more inputs and at least 1 output Effectiveness – Must be capable of performing each step Why are these properties important?

Problem Solving - Dr. Struble 8 Example 1 Consider the steps for accelerating in a car: 1. Move right foot to gas pedal. 2. Apply pressure to gas pedal with right foot. 3. If speed is too high, apply less pressure. 4. If speed is too low, apply more pressure. Is this an algorithm? Why or why not?

Problem Solving - Dr. Struble 9 Example 2 Problem: Count the number of times the name “Mary” appears in a list of names. 1. Get the list of names. 2. Set a counter to zero. 3. For each name in the list perform the following: a. Compare the name to “Mary” and if the name is “Mary”, add one to the counter. 4. Display the value of the counter, which is the number of time “Mary” appears.

Problem Solving - Dr. Struble 10 Problem Solving Phase Analysis and Specification – Read problem statement – Identify input and output – Identify transformation General Solution – Develop algorithm Verify – Try your algorithm yourself

Problem Solving - Dr. Struble 11 Case Study: Miles to Kilometers Problem: You are responsible for creating a vacation package for tourists from France. The tourists want to know how far they will travel in the United States on their vacation. Because the tourists are French, they would prefer to use metric distances.

Problem Solving - Dr. Struble 12 Case Study: Miles to Kilometers Analysis – Distances are given in miles in the United States – Distances are given in kilometers in France Goal: Transform a distance in miles to a distance in kilometers.

Problem Solving - Dr. Struble 13 Case Study: Miles To Kilometers Input – A distance in miles – Assign the name miles to represent this distance Output – The distance in kilometers – Assign the name kms to represent this distance Transformation – 1 mile is kilometers Sometimes, you have to look up facts to solve a problem.

Problem Solving - Dr. Struble 14 Case Study: Miles To Kilometers Design 1 1. Get the distance traveled in miles 2. Convert the distance to kilometers 3. Display the distance in kilometers

Problem Solving - Dr. Struble 15 Case Study: Miles To Kilometers Design 2 1. Get the distance in miles 2. Convert the distance to kilometers 2.1 The distance in kilometers is times the distance in miles. 3. Display the distance in kilometers

Problem Solving - Dr. Struble 16 Case Study: Miles to Kilometers Design 3 1. Get the distance in miles, using miles to represent that value. 2. Convert the distance to kilometers 2.1 Using kms to represent the distance in kilometers, kms = * miles 3. Display kms, the distance in kilometers

Problem Solving - Dr. Struble 17 Case Study: Miles to Kilometers Need to verify that the algorithm works with a few tests. mileskms What happens if miles is negative?

Problem Solving - Dr. Struble 18 Problem Solving Techniques Ask questions Look for things that are familiar Solve by analogy Means-ends analysis Divide and conquer Building-block approach Merging solutions

Problem Solving - Dr. Struble 19 Exercise Problem: You are creating a vending machine that dispenses small toys. The machine returns change to the customer in $1 coins, quarters, dimes, nickels, and pennies. The machine always gives change using the minimum number of coins. Given an amount in change, determine the number and kind of coins to give back to the customer.

Problem Solving - Dr. Struble 20 Programming Assignment Requirement Starting with program 2 Each submission must contain your algorithm – In comments at the top of your source file – Use outline format for now Failing to include an algorithm is a 20 point penalty.

Problem Solving - Dr. Struble 21 Programming Errors Compilation (syntax) errors: – Error in the form of a statement (misspelling, parenthesis, comma, etc. – Detected by compiler (at compile time) – Does not generate.obj file – Prints error messages Linker Errors – Doesn’t produce.exe – Maybe wrong header file, – Disagreement between functions prototype, definition and call

Problem Solving - Dr. Struble 22 Programming Errors Execution (runtime ) errors – Compiles but crashes during execution Logic Errors – Program compiles and executes ok, but produces the wrong output – Detected by the programmer – Hardest to find

Problem Solving - Dr. Struble 23

Problem Solving - Dr. Struble 24 Polya's 4 Step Process 1. Understand the problem 2. Devise a plan for solving the problem Algorithms 3. Implement the plan 4. Test the plan

Problem Solving - Dr. Struble 25 Understand the Problem Clearly identify the input and output State assumptions Try a few examples yourself – Identify a starting point – Note the steps that you took Problem analysis

Problem Solving - Dr. Struble 26 Devise a Plan Write an algorithm – Use previous experience if possible Large problems may require several smaller algorithms – Work on the parts you do understand – Refinement

Problem Solving - Dr. Struble 27 Implement the Plan Execute each step of the algorithm yourself – If you can't walk through the steps, you can't tell the computer how to solve the problem. Try executing with special values – Negative numbers – No input How does your algorithm handle … – reasonable data? – unreasonable data?