Description
Problem Statement:
Using the Eclipse IDE, write a single class Java program named PrintingPatterns that displays the
following patterns separately, one below the other, on the computer screen. See the Sample Output
below.
Use for loops to generate the four patterns.
After your program is capable of printing the patterns with a width of 10 characters (as in the sample
output)
1. Change your program so that a single numerical value in your code controls the width of the
patterns. That is, changing a single “10” to “20” in ONE place in your code causes the patterns to
be printed properly with a width of 20 characters (which means you should use a variable to
denote the maximum width).
2. Change your program so that a single character value in your code controls the character in the
pattern. That is, changing a single “#” to “*” in ONE place in your code causes the patterns to be
printed properly with another character.
Other requirements:
All characters must be printed individually by a single statement (inside a loop) of the form
System.out.print(“#”);
A statement of the form System.out.println(); can be used to move to the next line.
A statement of the form System.out.print(” “); can be used to display a single space
for the last two patterns.
There should be no other output statements in the program, and no extra line breaks before or
after patterns.
CST8132 Lab 1: Printing Patterns Page 2 of 3
Sample Output
#
##
###
####
#####
######
#######
########
#########
##########
##########
#########
########
#######
######
#####
####
###
##
#
##########
#########
########
#######
######
#####
####
###
##
#
#
##
###
####
#####
######
#######
########
#########
##########
Submission Requirements
1. Demonstrate your finished program to your lab professor.
2. Create a new assignment folder and name it:
CST8132____Lab1.
3. Place a copy of your PrintingPatterns.java file in the assignment folder.
4. Create an ZIP file of the assignment, and name it:
CST8132____Lab1.zip.
5. Upload the ZIP file to Blackboard.
CST8132 Lab 1: Printing Patterns Page 3 of 3
Grading Scheme:
5 marks: Correctness
o Patterns are correct
o Can change size in ONE place
o Can change character in ONE place
o For loops are used
o Spacing is correct
5 marks: Code Conventions and Submission
o Proper naming (use of Java naming conventions and following requirements)
o Use of comments in code
o Consistent and proper indentation and code alignment
o Good use of both vertical and horizontal whitespace for readability
o Submission correct
-5 marks: Code does not compile