Uploaded by Renée HJ

Program Design Worksheet

advertisement
Contents
Instructions: .................................................................................................................................................. 2
Problem 1: ................................................................................................................................................. 2
Problem Definition ................................................................................................................................ 2
IPO Chart ............................................................................................................................................... 2
Narrative Algorithm .............................................................................................................................. 2
Flow Chart ............................................................................................................................................. 3
Problem 2: ................................................................................................................................................. 4
Problem Definition ................................................................................................................................ 4
IPO Chart ............................................................................................................................................... 4
Narrative Algorithm .............................................................................................................................. 4
Flow Chart ............................................................................................................................................. 5
Problem 3 .................................................................................................................................................. 6
Problem Definition ................................................................................................................................ 6
IPO Chart ............................................................................................................................................... 6
Narrative Algorithm .............................................................................................................................. 6
Flow Chart ............................................................................................................................................. 7
Problem 4 .................................................................................................................................................. 8
Problem Definition ................................................................................................................................ 8
IPO Chart ............................................................................................................................................... 8
Narrative Algorithm .............................................................................................................................. 8
Flow Chart ............................................................................................................................................. 9
Problem 5 ................................................................................................................................................ 10
Problem Definition .............................................................................................................................. 10
IPO Chart ............................................................................................................................................. 10
Narrative Algorithm ............................................................................................................................ 10
Flow Chart ........................................................................................................................................... 11
Problem 6 ................................................................................................................................................ 12
Problem Definition .............................................................................................................................. 12
IPO Chart ............................................................................................................................................. 12
Narrative Algorithm ............................................................................................................................ 12
Flow Chart ........................................................................................................................................... 13
pg. 1
Renée Howard-Johnson
Program Design Tutorial
Instructions:
In solving the problems below, you are required to present a problem definition, IPO Chart, Narrative
Algorithm and Flow Chart for each.
Problem 1:
Write a program to enter an individual’s year of birth and the current year, and calculate and
return the individual’s age
Problem Definition
IPO Chart
INPUT/STORAGE
PROCESS
Narrative Algorithm
pg. 2
Renée Howard-Johnson
OUTPUT
Flow Chart
pg. 3
Renée Howard-Johnson
Problem 2:
Write a program to enter a number, double the number, and output the result
Problem Definition
IPO Chart
INPUT/STORAGE
PROCESS
Narrative Algorithm
pg. 4
Renée Howard-Johnson
OUTPUT
Flow Chart
pg. 5
Renée Howard-Johnson
Problem 3
A box can hold one and a half dozen cans of tomatoes. Read the number of boxes and the price of a can
of tomatoes; then calculate and print the total cost of all the cans of tomatoes.
Problem Definition
IPO Chart
INPUT/STORAGE
PROCESS
Narrative Algorithm
pg. 6
Renée Howard-Johnson
OUTPUT
Flow Chart
pg. 7
Renée Howard-Johnson
Problem 4
Write a program to accept four numbers and produce an output of their sum, average and product.
Problem Definition
IPO Chart
INPUT/STORAGE
PROCESS
Narrative Algorithm
pg. 8
Renée Howard-Johnson
OUTPUT
Flow Chart
pg. 9
Renée Howard-Johnson
Problem 5
Write a program to read a month in the year and print “This is the month of the rights of the child”, if
the month entered is “October”.
Problem Definition
IPO Chart
INPUT/STORAGE
PROCESS
Narrative Algorithm
pg. 10
Renée Howard-Johnson
OUTPUT
Flow Chart
pg. 11
Renée Howard-Johnson
Problem 6
Persons under the age of 18 are not allowed in at Shutters Night Club. Write a program to read a
person’s age. If the age is under 18, output “Underage”.
Problem Definition
IPO Chart
INPUT/STORAGE
PROCESS
Narrative Algorithm
pg. 12
Renée Howard-Johnson
OUTPUT
Flow Chart
pg. 13
Renée Howard-Johnson
Download