The problem statement
Upcoming SlideShare
Loading in...5
×
 

The problem statement

on

  • 385 views

 

Statistics

Views

Total Views
385
Views on SlideShare
385
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

The problem statement The problem statement Presentation Transcript

  • The Problem Statement
    The Defining Diagram
  • Introduction
    Defining the problem is the first step towards solving a problem.
    It is one of the most important steps in problem-solving.
    Many students tend to overlook this stage of the problem-solving process.
  • Defining the problem
    Defining the problem is a way to help the programmer understand what he or she is required to do.
    steps
    I. what is given (that is, the inputs),
    2. the expected results (that is, the output),
    3. the tasks that must be performed (that is, processing).
  • The Defining Diagram
  • input
    Given
    Read
    Accept
    Example
    A program is required to acceptfive numbers.
    Input >>>>>>> 5 numbers
  • output
    Print
    Display
    Produce
    Output
    Example
    A program is required to accept five numbers and output the first two.
    Output >>>>>>>>> first two numbers
  • processing
    "What do I have to do with the inputs in order to produce the desired output?"
  • Problem 1
    A program is required to read three (3) numbers calculate and print their total.
  • Problem 1
    A program is required to read three (3) numbers, calculate and print their total.
  • Problem 1
    A program is required to read three (3) numbers calculate and print their total.
  • Please note
    1. In the defining diagram, the actions must be listed in a logical sequential order.
    2. All the necessary actions must be explicitly stated. For example, the read action and the print action must not be assumed.
    3. The processing section is NOT the solution to the problem. It is simply a list of the things that must be done in order to solve the problem. Later on we will write an algorithm to tell the computer how to solve the problem.
    In some problems the input, output and processing parameters might not be stated as explicitly as in the one above. Let us look at an example of such.
  • Problem 2
    Given three numbers representing the age of‘ three boys respectively, write a program to find their average age and also determine the age of the oldest boy.
  • Problem 2
    Given three numbers representing the age of‘ three boys respectively, write a program to find their average age and also determine the age of the oldest boy.
  • Problem 3
    The cost of a new car is the sum of the wholesale cost, the local sales tax and the dealer's percentage mark-up. Assuming the dealer's mark-up is 10 percent of the wholesale cost and the sales tax is 6 percent, design a program to read a car ID and the wholesale cost of the car and print the car ID and the cost to the consumer.
  • Problem 3
    The cost of a new car is the sum of the wholesale cost, the local sales tax and the dealer's percentage mark-up. Assuming the dealer's mark-up is 10 percent of the wholesale cost and the sales tax is 6 percent, design a program to read a car ID and the wholesale cost of the car and print the car ID and the cost to the consumer.
  • Problem 3
    The cost of a new car is the sum of the wholesale cost, the local sales tax and the dealer's percentage mark-up. Assuming the dealer's mark-up is 10 percent of the wholesale cost and the sales tax is 6 percent, design a program to read a car ID and the wholesale cost of the car and print the car ID and the cost to the consumer.