The problem statement

271
-1

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
271
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

The problem statement

  1. 1. The Problem Statement <br />The Defining Diagram <br />
  2. 2. Introduction<br />Defining the problem is the first step towards solving a problem. <br />It is one of the most important steps in problem-solving.<br />Many students tend to overlook this stage of the problem-solving process.<br />
  3. 3. Defining the problem<br />Defining the problem is a way to help the programmer understand what he or she is required to do.<br />steps<br />I. what is given (that is, the inputs),<br />2. the expected results (that is, the output),<br />3. the tasks that must be performed (that is, processing).<br />
  4. 4. The Defining Diagram<br />
  5. 5. input<br />Given<br />Read <br /> Accept<br />Example <br />A program is required to acceptfive numbers.<br />Input >>>>>>> 5 numbers<br />
  6. 6. output<br />Print<br />Display<br /> Produce<br />Output<br />Example<br /> A program is required to accept five numbers and output the first two.<br />Output >>>>>>>>> first two numbers<br />
  7. 7. processing<br />"What do I have to do with the inputs in order to produce the desired output?"<br />
  8. 8. Problem 1<br />A program is required to read three (3) numbers calculate and print their total.<br />
  9. 9. Problem 1<br />A program is required to read three (3) numbers, calculate and print their total.<br />
  10. 10. Problem 1<br />A program is required to read three (3) numbers calculate and print their total.<br />
  11. 11. Please note<br />1. In the defining diagram, the actions must be listed in a logical sequential order.<br />2. All the necessary actions must be explicitly stated. For example, the read action and the print action must not be assumed.<br />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.<br />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.<br />
  12. 12. Problem 2<br />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.<br />
  13. 13. Problem 2<br />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.<br />
  14. 14. Problem 3<br />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.<br />
  15. 15. Problem 3<br />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.<br />
  16. 16. Problem 3<br />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.<br />

×