CSCI 161: Decomposition
Objectives
- Write a Java Project from scratch
- Decompose a problem into a set of smaller problems
- Use good naming conventions when creating methods
- Leverage your improved knowledge of the Java programming language to produce the desired output
Overview
- Write a complete program that produces the figures below as output.
- Use static methods to capture structure and eliminate redundancy in your program.
- Name your Java file
Decomposition.java
Style
Use good programming style: write comments, indent consistently, and use white space to make your program readable. Remember, you can press Ctrl+Shift+F in Eclipse to format your program, provided you have no serious syntax errors (like unbalanced braces, parentheses, or quotes).
Output Specification
Use PRECISELY the format shown below with the EXACT same spacing.
*
*
*
*****
*****
* *
*
* *
* *
*
* *
*****
*****
*
*
*
*****
*****
*****
*****
* *
*
* *
Required Methods
- Create one method for each of the 3 figures. Whitespace separating the figures should not be part of these
- Use additional static methods to eliminate redundancy.
- Create a
main()
method which will call other methods to draw each of the three figures
Hints and Reminders
- Create a new project for this lab. If you forget how, review the first lab
- There are 2 blank lines between figures.
- Each non-empty println should print exactly five characters. This may require trailing spaces to get to a total of five.
- Each line should be its own
System.out.println()
statement. Avoid using\n
- The only
println()
statements inmain()
should produce empty lines - Eliminate as much redundancy as possible — consider the number of different “subfigures” being drawn (hint: there are three)
Submission
Submit the Java source code file on Autolab under the “Decomposition” assignment.
Grading
- 20 points will be awarded for having a well-formatted, well-documented source code file. This includes your name, date, description, and comments throughout the program. This also includes other style requirements, such as method naming conventions. NOTE: The autograder will not display these points.
- 30 points will be awarded for proper decomposition of each figure
- 30 points will be awarded for proper abstractions for each figure
- 20 points will be awarded for matching the desired output exactly
- NOTE: if your program does not compile/run, the highest score you will earn will be a 20/100