Procedural
Decomposition with Static Methods
"Controlling Complexity is the essence of computer programming."
-- Brian
Kernighan
- Use static methods to eliminate redundancy and to
simplify your solution
Problem: Write a Java program
that prints the following output:
*****
*****
*
*
*
*
*
*****
*****
* *
*
* *
*****
*****
*
*
*
*****
*****
* *
*
* *
Different Solutions
- Unstructured
- Structured
- Structured
with redundancy eliminated
We want solutions that are:
- easy to understand
- easy to modify
A
Similar Program
Now take the program you wrote, and modify it to print
the
following:
*****
*****
*
*
*
*****
*****
*
*
*
*****
*****
*****
*****
* *
*
* *
*****
*****
*****
*****
* *
*
* *
*****
*****
*
*
*