Assignment 4

 

Before attempting this project, be sure you have completed all of the reading assignments, non-

graded exercises, discussions, and assignments to date.

 

(1) Write Java code to prompt the user for the starting number (e.g. 1) and output the triangle pattern below using nested for-loops.

 

 

(2) Write Java code to prompt the user for the starting number to print (e.g. 5) and output rectangular pattern below: Use nested for-loops.

 

 

Hint: Check out practice exercise 3 in the class materials.

 

Make sure your Java program is using the recommended style such as:

• Javadoc comment upfront with your name as author, date, and brief purpose of the program

• Comments for variables and blocks of code to describe major functionality

• Meaningful variable names and prompts

• Identifiers are written in upper CamelCase

• Class name starts with upper case letter and variables in lower case letter

• Constants are written in All Capitals

• Use proper spacing and empty lines to make code human-readable

Capture execution:

You should capture and label screen captures associated with compiling your code and running

a couple of different inputs for each program.

 

 

Submission requirements

 

Deliverables include Java program(s) (.java) and a single Word (or PDF) document. You can

code both exercises in a single java program or in two separate ones. The Java and Word/PDF

files should be named appropriately for the assignment (as indicated in the

SubmissionRequirements document.

 

The word (or PDF) document should include screen captures showing the successful compiling

and running of each of the programs. Each screen capture should be properly labeled clearly

indicate what the screen capture represents.

 

Submit your files to the Assignment 4 submission area no later than the due date listed in

your online classroom.

Grading Rubric:

The following grading rubric will be used to determine your grade:

 

Attribute Level 2 (15-20 points)

Level 1 (5-15 points)

Level 0 (0 – 5 points)

Triangle pattern Correct or one mistake in for-loop, and code to

output

Two mistakes in

loop logic and

resulting output

Three or

more

mistakes in

loop logic

and resulting

output

Rectangle pattern Correct or one mistake in for-loop,

and code to output

pattern

Two mistakes in

loop logic and

resulting output

Three or

more missing

essential

elements for

user input

User input Correct or one incorrect prompt and captured

input

Two mistakes in

prompts and/or

capture of input

Missing or close to

missing user input

Test cases A single Word or PDF

file showing the

program’s output with

at least two test cases

using different size

inputs for each pattern

implemented correctly

A single Word or

PDF file showing

the program’s

output with only

one test case for

each pattern

Missing or

significantly

incorrect or

incomplete test

cases

Program

documentation and style

Correct or one missing

program comment,

identifier, and/or screen

capture

Two incorrect

or incomplete

documentation

and/or style

elements

Three or more missing or

significantly incorrect

documentation and/or style

elements