M 3/2/15
A
|
HW due (both
blocks):
1. Redraw the flow chart on p. 47-1 so that it conforms to standard
flowcharting rules. In particular, check for the following:
·
Each
pathway should lead to the top of a
rectangle or diamond in the flowchart, never to the bottom or side.
Therefore, the “yes” branch of the second conditional diamond should be
rerouted so that it goes up and re-enters the first conditional from the top.
Note: If there is another path already
leading to the top of a rectangle or diamond, it is customary to have the new
path point instead to the midpoint of a segment that leads to the desired
target from above.
·
Flow
is always downward or to the right, with the exception of “loopback” arrows.
If you use a loopback arrow (e.g., the “yes” branch of the second conditional
diamond), each segment must include an arrow.
·
The
“no” branch from the “Does d divide n?” conditional diamond commits two
formatting violations. First, since it is not a loopback, the leftward flow
is not allowed. (The exits from the diamond should be on the bottom and
right.) Second, even if it were a loopback, which it is not, it would need an
arrow to indicate the leftward flow.
·
All
lines are either horizontal or vertical, with the exception of the
diamond-shaped “conditional” symbol. Curved lines are not allowed. Note: This requirement is already met
in the flowchart as shown.
·
Arrows
are not required for downward flow, since they add only visual clutter, not
actual information.
·
Downward
flow is preferred. Therefore, the final steps (“Print n” and “Stop”) should
be below the rest of the flowchart, not to the right. Also, those two steps
are entered from the left, which is a violation of the first formatting rule
above.
·
Crossing
lines should be avoided as much as possible.
There is no
single “right” way to draw a flowchart, but with a little practice, you can
make your flowcharts conform to the standard rules above. The advantage of
standard flowcharts is that they are easier to read and can be understood
much more quickly.
Note: When you are making
flowcharts for your own use (not to share with other people), no rules apply.
Do whatever you wish, just so long as it helps you understand the logical
flow!
2. Write the code suggested at the bottom of page 47-1. Test your code with
inputs of 6, 17, 100, 144, and a few other values. If you cannot write the
code on your own, you are encouraged to share ideas with classmates. Make
sure that you have a properly running program before you go on. Since your
code is only a few lines long, write it down on your HW paper after you have
it fully debugged.
3. Use System.currentTimeMillis() calls, as
suggested on page 47-2, to modify your code so that you can determine the run
time (in seconds) when you request the factors of 2000000000 (2 billion).
Record your run time (in seconds) on your HW paper, correct to the nearest
0.001 second.
4. Implement the slight improvement suggested at the bottom of page 47-2,
namely performing the calculation of n/2 only once, and storing that value in
a variable to be checked at the end of your do-while loop. Record your new
run time (in seconds) on your HW paper, correct to the nearest 0.001 second.
5. On your own (without help from classmates, please), implement the “Super
Optimized Code for Divisors of a Number” project at the bottom of page 47-3. Be prepared to show your optimized code
(either live or in a hard-copy printout) during class today. On your HW
paper, record your new run time (in seconds), correct to the nearest 0.001
second.
6. What is the “take-away” from this assignment? What did you learn, if
anything? Write a short paragraph.
|
|
|
Original Test Announcement:
Test (100 pts.) on Lessons 40-43 and 47. Some older material, dating back to the beginning of the
year, will also be included. However, the only older material that will be
included on this test will be AP-type content. (For example, the terms abend, BIOS, and cruft are all certainly worth knowing, but we have not discussed
any of those recently. Therefore, since they are not AP content, they will
not be on the test.)
What is the best way to review older material? You probably already know the
answer to that question. (Cough, cough, AP review book, cough, cough.)
During the test, you may use a note card if you wish, maximum size 5.5"
by 8.5" (double-sided) or 8.5" by 11" (single-sided).
|
|
Th
3/5/15
D
|
Snow day for
both blocks.
Test Instructions: Your
“do-at-home” portion consists of problem #1 (pages 2 through 9) of this
document. Work the entire problem, writing the requested answers directly
on fresh sheets of paper. Pencil is required. Format must conform to the
standard HW guidelines we have used all year, except that you may use the full width
of the paper. Stapling is not required, but each continuation sheet must have
your initials on it as shown in the HW guidelines, regardless of whether or
not you used a staple. Deadline is 3:00 p.m. Friday. (If school is canceled
Friday, the deadline will be extended until 3:00 p.m. on Monday.) Hand your
submission in person to Mr. Hansen.
The rest of the points on the test will come from a 20-minute in-class quiz
on Monday.
Additional rules (read all of these
before beginning your work):
(1) Work alone. When you write your name in the upper right corner of the
paper, you are certifying that the work presented is yours and yours alone.
(2) Record a time log (start and end time) near your name. The recommended
time for this problem is 25 minutes, but since there is a great deal of
reading, you may need more than 25 minutes. Take as much time as you need,
but when you stand up from your work area, you are finished. Record the end
time, and that’s that. You must work on problem #1 in one uninterrupted
stretch of time.
(3) You may use your cheat sheet that you previously prepared for today’s
test, but you are on your honor not to use any other resources. You may not
visit any other web pages during the time that you are working on problem #1.
If a parent or a sibling stumbles in on you while you are working, please ask
to be left alone.
(4) No help from other human beings is permitted on this assignment. That is
different from normal HW, on which you are encouraged to share ideas with
other students (as long as the work you write down is still your own work, in
your own words).
(5) You may not use a computer during the time you are working on problem #1.
Exception: If you are unable to
print out the problem (pages 2-9 of the document whose link is provided
above), you may use your computer, but only for the purpose of viewing the
question.
(6) Bonus points: Up to 5 bonus points are available if you go back, after you have finished working on the
problem and have finalized your time log, and correct your answers. YOU MUST USE A DIFFERENT COLOR (RED
RECOMMENDED) IF YOU DO THIS. Solutions are readily available online; you
can find them with a Google search. The link is not provided, because you
need to work the problem on your own, without support of any kind, and if the
link were provided, there would be too much temptation to peek at the
solutions before you started.
|
|
T 3/31/15
E
|
HW due (Block
2):
1. Redo #9 from the multiple-choice problem set. Everyone got this wrong, so
everyone has something to learn from this problem. Use a computer and compile
the code if that helps you. (You can’t do that during the real AP exam, of
course, but seeing the code run may help you understand better.) The problem
is #40 on p. 407 of your Barron’s book, but if at all possible, please don’t
read the explanation in the answer key; you will learn much more if you
puzzle it out on your own.
2. Write up a short “lessons learned” paragraph to yourself after you are
satisfied that you have found the correct answer. You may confer with
classmates, but the paragraph you write must be your own work, in your own
words.
3. Continue working every night on review problems from the Barron’s book.
Suggested workload is 25-35 minutes per weeknight.
Block 5: No class, but continue working every night on review problems from
the Barron’s book. Suggested workload is 25-35 minutes per weeknight.
|
|