CST8132 Assignment #1 For Loops and Printing Patterns solved



Problem Statement:
Using the Eclipse IDE, write a Java program that displays the following
patterns separately, one below the other, on the computer screen. See the
Required Output below.
Use for loops to generate the patterns. After your program is capable of
printing the patterns with a width of 10 characters (as in the sample
output), 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.
All ampersands (#) 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.
Submission Requirements
Required Output (10 ampersands)
1. Demonstrate your finished program to your lab instructor.
2. Copy your Eclipse project folder into another folder named
the following (using your own Lastname and Firstname)
Lastname_Firstname_CST8132_Lab1 and create a zip
archive of that folder. Be sure that your zip archive unzips to
produce the folder with your name on it, which itself should
contain a single folder (your Eclipse project folder).
3. Upload your zip archive through the Lab 1 link in Blackboard.
Grading Scheme:
5 marks: Correctness
5 marks: Readability