Th
3/1/012
|
Test (100
pts.) through Chapter 7, including class discussions.
|
|
F 3/2/012
|
HW due: Use a computer to complete the following assignment, which
will count toward your test score and will also count as a HW score. Make a
hard copy printout of your code. Be sure to include proper indenting and at
least 2 comments in order to earn full credit.
Assignment: Write a program that determines the number of months
between any 2 given months, inclusive, by means of a method called countMonths.
The countMonths
method is to accept 4 integer inputs: start month (1 to 12), start year (YYYY
format), end month (1 to 12), and end year (YYYY format). The main method is already written for
you.
Required error checking: End year cannot be less than start year. If end year
equals start year, then end month must be greater than or equal to start
month. Start and end months must be integers from 1 to 12, inclusive, and
start and end years must be integers from 1066 through 2999, inclusive.
public static void main(String[] args) {
System.out.print("Number of months from 1/1928
to 7/2003 = ");
System.out.println(countMonths(1,1928,7,2003));
System.out.print("Number of months from 3/1911
to 2/1948 = ");
System.out.println(countMonths(3,1911,2,1948));
}
|
|
M 3/5/012
|
HW due: Finish Friday’s assignment, following all of the
requirements. Proper indenting, at least 2 comments, and error checking are
all required.
Note: If you turned in a printout
and source code listing on Friday, you are exempt from having to do this
again.
|
|
T 3/6/012
|
No class, but please e-mail a draft of your project proposal if
possible. (See 3/7 calendar entry.)
|
|
W 3/7/012
|
HW due:
1. Develop a project proposal and a notional timeline. Please e-mail it to
Mr. Hansen (using a double underscore prefix in the subject line to improve
the chances of getting through the spam blocker) by Tuesday if possible. That
way, you can get some initial feedback on your proposal. Possible project
ideas we discussed in class include rainbow tables for password hash lookup,
a maze builder, a Sudoku solver, a writing-style analyzer, a numerology
explorer, an event simulator for probability estimation (Monte Carlo method),
and a GUI version of tic-tac-toe. Use one of these, or invent one of your
own.
Length: 3-5 sentences for the project description, 3-5 milestones for your
planned schedule. The schedule can and will be adjusted later. Don’t worry at
this point about getting everything correct.
2. Write Exercise 7.5, parts 1-4 only. Bring a printout of your source code
to class. (A printout of your output is optional.)
|
|
Th
3/8/012
|
HW due:
1. Finish Exercise 7.5 if you have not already done so. This printout will be
reviewed in detail.
2. Begin working on your project. Mark a section of your 3-ring binder as
“PROJECT NOTES” so that you have a place to put all of your design
documentation and thoughts regarding your project.
3. For today, all you are expected to produce is a short requirements
document. Read the example below to get a sense of the level of detail that
is expected. You can be less detailed than this if you wish. Approximately 5
to 10 lines of operational requirements would be a good target for now. The
purpose is to start thinking about the types of decisions that you will be up
against when you start making your detailed design in a few days.
PROJECT NOTES: Clef Training System (CTS)
Operational Requirements
General note: Throughout these
requirements, “random” means “pseudorandom.”
1. CTS must be able to accept user input via computer keyboard or a MIDI
keyboard. Mouse input is not required.
2. User shall be given a choice of clefs: treble, alto, tenor, or bass.
3. Clefs, staffs, and notes shall be rendered graphically for display on a
monitor.
4. CTS will generate randomly chosen notes between 2 leger
lines below the staff and 3 leger lines above the
staff, inclusive. Each challenge posed to the user shall consist of 1 to 4
separate notes (not chords), with all notes of the same randomly chosen
rhythmic value, either whole notes, half notes, quarter notes, eighth notes,
or sixteenth notes.
5. Eighths and sixteenths shall be barred together. Bars showing the trend of
the musical line are not required; horizontal bars are acceptable.
6. Stems must point in the proper direction, and barred stems must all go the
same direction. When barring notes that would otherwise have a mixture of
stem directions, the majority direction will rule. If the number of stems
that would normally go up equals the number that would normally go down, the
resolution shall be made randomly.
7. CTS will begin by offering the user a choice of clef (coded as 1, 2, 3, or
4) and a time limit (1-9 seconds) to use for responding to each challenge.
Challenges are then to be presented one at a time, with 1 point awarded for
each challenge that is answered correctly within the allocated time. Answers
are to be entered as a sequence of keystrokes (e.g., C E G for a C major
triad) or as a sequence of MIDI events, but not both.
8. Running score and elapsed time since start of game are to be displayed in
the upper right corner of the screen.
9. The game shall end when the user presses the ESC key.
10. There is no current requirement for the user to be able to pause the game. That is a future enhancement for version
2.0.
11. Error checking: Clef choice and time limit inputs must be numeric. Note
inputs must be A through G, inclusive, case insensitive, or if entered via MIDI,
must be in the form of keypress events that end
before the challenge time expires. Input errors are to be communicated to the
user with a simple beep and a status line message suggesting the proper type
of keystroke to press. If there are more than 5 errors in a row, the banner
shall be replaced with a status line message suggesting how to exit (by
pressing ESC).
Other Requirements
12. Internal errors shall be flagged with a numeric code and presented in a
dialog box.
13. Source code shall contain at least one comment summarizing the operation
of each method or each functionally significant group of lines. Thorough
descriptions of functionality are not expected.
14. Meaningful variable names shall be used throughout.
|
|
F 3/9/012
|
HW due: The version of MyExp that we
slapped together yesterday in class has a number of bugs. Enter the code
below, correct all the bugs, and test for proper operation using a “main”
method that calls this version of MyExp.
public static double MyExp(double
x, int y) {
//x is argument of "exp" function
//n is # of terms beyond the zeroth
term (which is 1.0) to be included
double accum = 1.0;
double prevterm = 1.0;
int termno =
1; //loop counter
while (i <= n) {
accum = accum
+ prevterm * x/n;
prevterm = prevterm * x/n; //update value of prevterm for next time
termno += 1;
}
return accum;
}
|
|
M 3/12/012
|
No class.
|
|
T 3/13/012
|
Substitute class to replace Monday’s
class that was not held.
HW due today: Continue working on the detailed design of your project. Write
your detailed design as a flowchart, as pseudocode,
or as a combination of those formats. You should not be writing code yet
unless you are crystal clear on what it is that you are doing. The last time
I checked, nobody was to that point yet.
The expectation for today is that you will have made some substantial
conceptual progress toward getting your ideas down on paper, even if you have
written no code. It is actually a good sign if you have written no code yet.
However, your written design documents should be intelligible to another
reader. If that means you need to make a messy draft to get your creative
juices flowing, followed by a neater draft after you have worked some things
out in your mind, that is fine (and quite common, by the way).
|
|
W 3/14/012
|
HW due: Read Chapter 8 (pp. 91-100) and continue working on your
project design.
In class: Design review. (That means that you will need to show your design
notes, which should be somewhat intelligible, and answer oral questions
concerning what you plan to do with your design.)
|
|
Th
3/15/012
|
HW due: Write Exercise 8.1 on p. 93, and continue working on your
project. By the end of this week, you will be asked to provide a more
detailed estimate of the time needed for developing and debugging your
application.
|
|
F 3/16/012
|
HW due: Work on your project.
In class: Project planning and milestone revision.
|
|
M 3/19/012
|
HW due: In honor of Stub Week and your projects that are in progress,
there is only a skimpy written assignment for this weekend. Here it is:
Write Exercise 8.7 on p. 103.
|
|
T 3/20/012
|
No class.
|
|
W 3/21/012
|
HW due: Read Chapter 9 (pp. 107-116); write Exercise 9.1 on p. 117.
|
|
|
Spring break, March 22–April 1.
|
|