||CS 112 - Introduction to Computer Science II
Assignment work will be individual for this assignment only. Due:
Friday 1/26 at the beginning of class 3.
Include a README file with the honor pledge, your name and student ID, and
written exercises. We will cover the submission process in class.
Be sure to have your README and ModularPascalsTriangle.java in the same default package directory.
1. Bash: Have you already learned the
basics of the bash shell?
2. Eclipse: (Optional: Watch the
introduction video. This can be viewed on non-Linux campus computers.) In
class: Do the Eclipse tutorial "Create
a Hello World application". Get to the Welcome screen either at first
startup or via Help→Welcome. Choose "Tutorials".
Under "Java Development", choose "Create
a Hello World application". Follow the tutorial instructions step-by-step in
the "Welcome" tab in the right margin. Since we'll be doing this
in class, there will be nothing you'll need to submit; your attendance and
participation will give you full credit.
Yes: Consult online documentation, learn three new things about the bash
shell, and describe them briefly. Include these descriptions in your
No: Do the bash tutorial ("Getting
started with bash at Gettysburg"). Do
the tutorial in one sitting so that you'll be able to submit a transcript
of your shell commands. These will be appended to a "README" file which
can be submitted via Moodle.
The more you know of your work
environment, the more efficient you will be. A little time spent above and
beyond these tutorials will likely pay off significantly in the long run as a CS
3. Modular Pascal's Triangle: Read about
For this exercise, you will be computing a 2D array with a Modular Pascal's
Triangle, that is, a Pascal's Triangle formed with
(This will be similar in arrangement to the last Fibonacci pattern figure of
Wikipedia article section, with blank areas filled with 0's.) Implement and submit ModularPascalsTriangle.java according to
Optionally, here's some fun you can have while testing your program:
- You may visualize the beautiful patterns formed by your code using
ModularPascalsTrianglePlot.java. For modulus 2, you'll see the
triangle pattern. This needs to be compiled in the same directory
as your ModularPascalsTriangle.java and should be run from the command
prompt as follows: "java ModularPascalsTrianglePlot <size> <mod>" where the
<size> is the number of rows and the number of columns. E.g.
"java ModularPascalsTrianglePlot 400 5". Zeros are colored white and
from 1 to the modulus minus 1 fades from red to yellow to green to blue.
- For any prime modulus, what do you observe about the patterns? Try
2, 3, 5, 7, 11, and 107 for different sizes.
- For these prime plots, what do you observe at the top of each of the
white (zero) downward triangles?
- For simple non-primes (e.g. 6), do you observe any interesting patterns?