$30
Assignment No. 1
EECS 368
Programming Language Paradigms
Deliverables:
1. Copy of Rubric1.docx with your name and ID filled out (do not submit a PDF)
2. JavaScript source code.
3. Screen print showing the successful execution of your JavaScript code or copy
and paste the output from a web browser console screen to a Word document and
PDF it.
Assignment:
• Create in a single file, the JavaScript code for the following modified exercises at
the end of Chapter 2 in Eloquent JavaScript
• Your code should print out the name of the exercise before each exercise (e.g.,
“Looping a triangle”).
• Provide comments that explain what each line of code is doing. See rubric below.
• Exercise 2.1 - Looping a triangle
o Write a loop that makes 10 calls to console.log to output the following
triangle:
x
xx
xxx
xxxx
xxxxx
xxxxxx
xxxxxxx
xxxxxxxx
xxxxxxxxx
xxxxxxxxxx
• Exercise 2.2 – FizzBuzz
o Write a program that uses console.log to print all the numbers from 1 to
100, with three exceptions:
For numbers divisible by 4, print "Divisible by 4" instead of the
number.
For numbers divisible by 7, but not 4, print "Divisible by 7, but not
4" instead.
For numbers divisible by both 4 and 7, print “Divisible by both 4
and 7”.
• Exercise 2.3 – n-by-n Grid
o Write a program that creates a string that represents an n-by-n grid, using
newline characters to separate lines.
o At each position of the grid there is either a space or a "*" character.
o The first position should be a space.
o Define a binding name “size” so that it works for any size, outputting a
square grid of the given width and height.
o Show the output for size = 8 and size = 14.
o Between the output for each size, print out the size (e.g. “size = 6”).
o For example, if size = 8, the grid would look like this:
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
Rubric for Program Comments
Exceeds Expectations
(90-100%)
Meets Expectations
(80-89%)
Unsatisfactory
(0-79%)
Software is adequately
commented with prologue
comments, comments
summarizing major blocks of
code, and comments on every
line.
Prologue comments are present
but missing some items or some
major blocks of code are not
commented or there are
inadequate comments on each
line.
Prologue comments are missing
all together or there are no
comments on major blocks of
code or there are very few
comments on each line.
Remember:
• Your Programming Assignments are individual-effort.
• You can brainstorm with other students and help them work through problems in
their programs, but everyone should have their own unique assignment programs.