THE DEFINING DIAGRAM
A table with three columns which represents the three components: input, processing and output.
* Input refers to the source data provided - easily identified by the keywords – given, read or accept, input
* Output refers to the end result required - keywords are print, display, produce, output
*Processing are the actions must be performed to achieve the required output - it answers the question: What must I do with the inputs in order to produce the desired result?
PROBLEM 1:
Write a solution to read three numbers and calculate and print the total.
INPUT
|
PROCESSING
|
OUTPUT
|
3 numbers
e.g. num1, num2, num3
|
- Get 3 numbers
- Add numbers together
- Print total.
|
Total
|
PROBLEM 2:
Given three integers representing the age of three boys respectively, write a solution to find their average age.
INPUT
|
PROCESSING
|
OUTPUT
|
3 integers
e.g.age1, age2, age3
|
- Read/accept/get 3 integers
- Add the 3 ages
- Divide total by 3
- Print the average,
|
Average
|
Comments (0)
You don't have permission to comment on this page.