Post-4
- Review all of Module 5. (Yes, twice.) Include in
your review the parts we did not cover in class.
- Complete all in-class exercises in Module 5.
- Skim through sections 2.1 and 2.2 of
the textbook (we'll be covering some of this in class), but
read section 2.3 (for-loops) carefully.
- Do the self-check exercises 22, 23, 24, and 25
in Chapter 2, on pages 121-122 of the textbook.
- Write a program called Block.java that
uses nested for-loops to print the following:
******
******
******
******
However, you should use only the decrement operator
(as in i--) in your loops.
- Write a program called
Diagonal.java
with a nested for-loop to print this output:
5
4
3
2
1
Note: there are five spaces before the 5, four
spaces before the 4, ... etc.
- The for-loop design contest.
In this part of the assignment, we'll have some fun with
for-loops. Write a program called Contest.java
with the following features:
- You must use exactly four for-loops. That is, the
reserved word for needs to appear four times.
- At least one for-loop needs to be nested.
- You must use at least four but not more than eight
System.out.print's or System.out.println's.
A total of eight combined.
- Each System.out.print or System.out.println
is allowed to print at most one letter.
- All your code needs to be written in the main
method. That is, you can't use other methods.
The goal is to be creative in your program. We will give points
for creativity and complexity. Both the code structure and
the output will be evaluated.
Important: you need to understand your code and
be prepared to explain it class. The best way to do this
is to be sure you've traced through an execution of
your prorgram step by step (on paper).
- Please learn how to make a ZIP file out of a folder.
From next week onwards, you'll be uploading ZIP files into
Blackboard instead of your individual Java programs.
- Don't forget your reflection exercise!
Submission: For this assignment, we'll use Blackboard (BB)
for submission. Go to assignments and then
to post-4.
Note that you'll upload your files one at a time in BB. For this
purpose, there are three Post-4 assignments in BB.
Next time onwards, we'll use a single zip file.
Recommended, but not required:
- Who was the world's first programmer? Can you resist the urge
to type this question in Google, and try to find out
some other way? Perhaps by reading about the history of computers?
- Look up the Clay Institute and its list of
Millenium Prize problems. What is the computer
science problem on the list?