Computer Science APEA 15-100, Summer 2009
Homework 3
Due: Thu 2-Jul-2009 at 8:59am (email copy only)
(no late submissions accepted).
Read these instructions first!
- Be sure to include your name, your Andrew ID, and your section clearly on the top of each file in your assignment.
- For non-programming problems:
- Place all your solutions to the non-programming problems in a single
file named Hw3 (with whatever extension is appropriate for the format you
choose, such as Hw3.txt or Hw3.html, etc). You must use one of these
file formats: plain text (txt), or RTF, or HTML, or Word (doc, not docx), or
PDF. No other file formats will be accepted.
- Show your work. Correct answers without supporting
calculations will not receive full credit.
- For programming problems:
- Place each solution in its own file named exactly as given below, and
with a class name that exactly matches the file name. So if the file name
is Hw3Foo.java, the main class in that file must be Hw3Foo.
- Try to use well-named variables, proper indenting, reasonable commenting,
etc.
- Note: You may not use Java concepts we have not yet covered,
including loops (do/while/for), conditionals
("if" statements or tertiary operators (?:)), arrays, or methods
from any classes in java.util.* (besides Scanner or others we explicitly
use) to solve these problems
(which isn't a problem for most of you, seeing as we have not yet covered
these!). While they may be helpful, every problem here is solvable without
them, and they are not permitted for now.
- What to submit
- Create a submission directory like this: "koz-hw3" (replace
"koz" with your andrew id)
- Place all the files you are submitting in that directory, zip that
directory, and submit the zipped directory
- How to submit
- Send an email with the zipped submission directory as an attachment
to your CA by the submission deadline. Do not miss the deadline,
even by one minute! Email problems are not a valid excuse
for late submissions.
- It is recommended
that you "cc" yourself in that email, too, just to confirm that you properly
sent the email.
- Note:
- Improper submissions will be penalized up to 10 points and may be
rejected.
- Late submissions will be rejected.
- Reading
Finish reading Chapter 1 carefully for tomorrow's quiz, which covers all of
Chapter 1. This is an abridged assignment in order to provide enough
time for you to carefully read the textbook.
- Fix the Extra-Pixel Problem
Starting from the code you submitted for hw2, fix the flags of Benin and
Azerbaijan (skipping Panama) so that they no longer suffer the extra-pixel
problem. Place the fixed flags in the files Hw3FlagOfBenin.java and
Hw3FlagOfAzerbaijan.java, respectively.
- Sample Quiz Questions
Write 5 sample quiz questions: 2 easy questions, 2 medium questions,
and 1 hard question. They should cover randomly-chosen topics from the
many that may appear on tomorrow's quiz, taken from Chapter 1 reading and
the course notes, labs, and other materials. For reasons that will
soon become clear, you should really try to randomize your topic choices.
In any case, they should be similar in spirit to the sorts of questions you
have seen so far, but as different as possible from those questions (eg, if
you simply change the numbers on an existing question, you will not get full
credit). Be creative, but do not obsess too long on this question (no
more than 30 minutes).
- Group Study
Form a study group of around 4 students (no more than 5 in any case,
preferably no groups smaller than 3). Don't be "clique-ish", as the
next time you are in a study group you will have to pair up with all new
partners anyhow. As a group, work through each of your sample quiz
questions, solving them collectively. This activity should require at
least 30 minutes. For this problem, each of you should submit a list
of the names of everyone in your group, when, where, and for how long you
met. (Don't forget to also submit your 5 sample questions, along with
their solutions, from the previous problem!)
To facilitate study group formation, it is highly recommended that you
appear around 8pm either at the office hours or at the Morewood cluster or
commons (note that office hours start at 7pm, but this leaves you an hour to
read and to write your questions). If this is impossible, please inform your instructor and your
CA (and for a compelling enough reason, such as a conflicting evening class,
you will be exempted from the group study portion of this assignment).
- Bonus/Optional:
Flag of Panama, Stars Included
Draw the flag of Panama using Polygons for the stars. To get you
started, here is some sample code using a Polygon:
Polygon p = new Polygon();
p.addPoint(100, 50);
p.addPoint(200, 125);
p.addPoint(300, 50);
page.setColor(Color.black);
page.fillPolygon(p);
This is really all you need for this task, but if you need more
information, check out the Java API link from the course web site.
Carpe diem!