CIT 591 Old Announcements
Fall 2004, David Matuszek

Date Announcements
December 19

CIT 591 Study session

I have reserved Levine 307 on Tuesday, from 6pm to 8pm for anyone who would like to get together and study for the final exam. I expect to be there at least part of the time, but I'm not going to present or anything. This is totally optional, of course.

Please try to get a good night's sleep before the exam. It's probably more important to be awake and careful than to do last-minute cramming.

December 19 The midterm exam and the midterm answer key are on the web.
December 16

The final exam is Wednesday, December 22, 8:30 - 10:30, in David Rittenhouse Labs A4.

As I said in class, the final will be comprehensive. If you have heard a rumor that it isn't, it isn't based on anything I said.

On the midterm I asked you to create a complete program, one line at a time, according to comments I provided. The final exam has a similar question, but this time the program creates and uses a GUI.

There are several questions that give you some code and ask you to figure out what it computes or prints. Some of the code uses interfaces, abstract classes, and inner classes.

There are questions about JUnit and Javadoc, as well as some questions about Java operators and statements.

Finally, you will be asked to define one or more terms.

December 16

Last assignment (short token counter):

Remember, your program must pass all the tests in my JavaTokenCounterTest class, or it gets a grade of zero.

If you did not submit a passing program before midnight, December 14, you can still submit a program any time before the final exam. Late programs will receive a late penalty and will not be eligible for bonus points.

December 10

If you are interested in participating in the final contest, here are the numbers to beat:

First place: 1614 tokens
Second place: 1852 tokens
Third place: 2024 tokens
Fourth place: 2578 tokens

Following these: 2911, 2929, 2991, and several programs with non-comment token counts above 3000. In addition, there are several "dark horse" programs that have been submitted without giving the token counts in the Blackboard comments (guys, it's time to start reading the assignments!).

So far, I have verified only the program currently in first place, which passes all my JUnit tests and is the length that it is claimed to be (and there are some easy ways to make it even shorter!).

Remember, the final lab on December 10 is optional. You can use this lab time to meet with your partner and discuss how to further reduce your token count, if you wish. Remember, the last day to turn in assignment 9 is December 14.

December 7 I've posted grade averages for all the work that's been graded so far.
December 7 MCIT and MSE (Masters) Pizza Bash
6:15 pm on Thursday Dec. 9 in Levine 307
December 6
10:30 p.m.
Not a correction this time, but an addition of some more uncommon syntax to for use with the final assignment. Those of you that are working late tonight: These additions will only be used for the final assignment, not for assignment 8.
December 6
5:30 p.m.
Yet another correction to
I wasn't checking punctuation counts at all--my verify method ignored them. So even though one of my counts was wrong (in testStatements()), my JUnit tests didn't catch the error. Fixed.
December 5

I have added three file to this web site:

  • My JUnit test class.
    • If you downloaded this class before 11:30 p.m. Sunday, testOperators() said there were 40 operators--there are 38. Fixed now. Sorry.
  • Revised grading for assignment 9 (important!), including counts for my own token counter program.
  • Some reminders on escaping characters (important if you are having trouble counting character literals and/or String literals).
December 1

Extension: Assignment 8, Java Token Counter, is now due before midnight, Monday, December 6. However, a new assignment will be given out in Lab this Friday, and it will depend on your Java Token Counter.

I've posted some further Token Counter assignment clarifications, based primarily on questions people have asked me.

December 1


Thursday, December 2, 6:30 PM
Heilmeier Hall

Dave Millar, University of Pennsylvania Information Security Officer, will talk on personal computer security: that is, how avoid (or recover from) problems such as viruses, spyware, spam, and phishing. This talk is aimed at a general audience.

All interested students and faculty are invited to attend.

November 19

Upcoming dates:
     Thursday, December 2 -- First talk in MCIT Lecture Series
     Thursday, December 9 -- Next pizza party

November 11 The calculator assignment, originally due Monday, November 15, is now due Thursday, November 18. I am also tightening up the specifications a bit, as described on this page.
We do have lab this Friday (November 12).
November 11 Don't make the calculator assignment harder than it has to be! All that I'm asking for is that it behave much like a cheap dime-store calculator, doing one operation at a time.
 •You do not need to worry about precedence of operations: 2+3*5= should give 25, not 17.
 •The calculator should display Error (or something like that) if you divide by zero.
 •Most calculators, when you enter something like 2/+*3, just use the last operation (*) rather than give an error.
 •JUnit is not designed for testing GUIs, and you aren't required to use it.
November 9 MCIT and MSE (Masters) Pizza Bash
6:15 pm on Thursday Nov. 11 in Levine 307
November 6 I've posted a fairly long (but very dense) page containing everything you will ever need to know about Object-Oriented Concepts. Some tiny fraction of this will be on the midterm exam.
November 6 Here are some Layout examples in Swing.
November 5 First correction (sigh!)...I said that all your public methods should be made available on the calculator. Let me amend that--all your public methods that result in a number should be made available on your calculator. You do not need to have keys for methods like lessThan, greaterThan, and approximatelyEquals. Likewise, you will probably use toString when you display your results, but it doesn't make sense as a calculator key.
November 5

Over the weekend I plan to post more Swing examples, and probably a bit more about the midterm.

The midterm will cover everything we have talked about so far except Swing. Swing will not be on the midterm exam.

November 4

We have a tutor for CIT591, CIT592, and CIT593. His name is Leland Weeks, . To get things started, he will be available in Weiss Tech House at the following times:

  • Mondays: 4:30 PM - 6:00 PM
  • Wednesdays: 10:00 AM - 12:00 PM
  • Fridays: 1:00 PM - 3:00 PM

Leland is willing to meet with you at other (mutually convenient) times. This is a free service (as in, the Department pays for his time), so don't be shy! Let's make it worth his while!

November 4

I've posted a program that should help you to write Swing GUIs ( This will unzip into two files, SwingExamples.jar and You must keep these files together in the same directory. If your Java is installed correctly, you can run the program by double-clicking on SwingExamples.jar. If it isn't, you can change the file name to, unzip it (there are a lot of classes there), make sure the file is in the same directory as the class files, and run it from there.

November 3

Yes, you are supposed to test for Exceptions. If you haven't figured it out yet,

    try {
        new Fraction("hello");
    catch (NumberFormatException e) { } 
November 3 I've posted some notes on Testing Fractions and Complex Numbers.
November 2 A better name for testEquals would be assertEquals.
November 1

For comparing Complex numbers, you can use this code in your JUnit test class:

    private void testEquals(Complex expected, Complex actual)
            throws AssertionFailedError {
        if (expected.approximatelyEquals(actual)) return;
        throw new AssertionFailedError("expected: <" + expected +
                                       "> but was: <" + actual + ">");
(You may need to import junit.framework.*;)).
November 1 Interesting website:
by someone whose name you may recognize:
If you can, please vote!!
October 30

In the previous assignment (Mad Libs), I said:

Coding style (indentation and spacing) will be considered in grading this project. See the Java™ Style Guide for Sun's official rules, at

It is clear that many of you never looked at this. For the current assignment we are going to get serious about style, so I strongly advise you to read it before you submit your programs.

October 28 If people show up, we can try some more code walkthroughs this week. Come and bring your least favorite program! Levine 307, at 2:00 Friday.
October 27 The current assignment (Fractions and Complex Numbers) will be due Thursday, November 4, before midnight.
The lab this Friday will almost certainly be about Eclipse.
October 24 I've posted a complete example of a simple class with JUnit testing, as
October 24

Changes to the Complex class:

  • Change public Complex abs() to public double abs(). The absolute value of a complex number is always a real number, so it's silly to return a complex number with a zero imaginary part.

  • Add the method public double distance(Complex c). You need this method anyway (for writing approximatelyEquals, and I somehow forgot to list it.

  • Define approximatelyEquals for complex numbers to mean that the distance between them is less than 0.001. This is simpler to implement than the original statement, but more importantly, allows you to use the JUnit method assertEquals(expected, actual, 0.001), where expected and actual are doubles.

These changes should be reflected in the JUnit tests.

October 22 Complex numbers: I've added a missing sqrt(...) to the absolute value operation; and I've replaced the formula for complex division with a simpler (though longer) version.
October 22 Remember, we will do some code walkthroughs today at 2:00 in Moore 216. Everyone is encouraged (not required) to attend, and I still need some willing victims volunteers to present their code.
October 21 Midterm exam date moved to November 8, since November 3 is right after the election. If you're registered, vote!
October 19 Is it really all that hard to put "591" in your Subject: line? See the note above, which has been there all semester. Thanks.
October 19 No office hours today. Sorry.
October 15

Hints on the Mad Libs assignment:

  • Read the documentation for the LineReader class.
  • Read the documentation for java.util.ArrayList.
  • Read the documentation for java.lang.String.

We have an acronym in computer science: RTFM, which stands for Read The Fine Manual--or something like that, anyway.

October 14 Sample output for jigsaw puzzle problem.
October 11 I have modified the Jigsaw Puzzle assignment to be much more specific about what to print when.
October 8 We now have a CIT 591 discussion group set up on Blackboard. You can use this to discuss assignments, problems, etc. with other students. (I'll look at it occasionally, but probably not very often.) Since we have a class rule against copying code, please do not post completed or partially completed assignments there--at least, not until well after their due date.
October 8

Jigsaw Assignment clarification: The print() method in Puzzle only prints the piece numbers, not their edges. So when you print out a puzzle, it will look something like this:

   1   2   3   4
   5   6   7   8
   9  10 --- ---
(This is a printout of an incomplete puzzle--the last two pieces are missing.)
October 7 Grading policy reminder: The late penalty is only 5 points per day (out of 100). It is much better to turn in a working program a day or two late than to turn in a nonworking program. You can turn in programs up to a week late.
October 7

In the assignment:
"Too close" means that the number of moves required to reach the destination is less than half the number of rows AND is less than half the number of columns.
If the trafficGrid has nRows rows and nColumns columns,
and it will take distance moves for a car to reach its destination,
then the destination is too close if:
    (distance < nRows / 2) && (distance < nColumns / 2)

September 27 Another correction (sigh):
     rand.nextInt(n) gives a number in the range 0..n-1, not 0..n.
And a comment:
     To get p percent of n, use (p * n) / 100.
September 25

Yet another correction:
(20 * number of acres you have * amount of grain you have in storage) / (100 * population) + 1
should be
(20 * number of acres you have + amount of grain you have in storage) / (100 * population) + 1

September 24

Minor corrections to assignment:

  • Clarified (I hope!) that the first summary is printed before you begin your rule
  • You start with 100 people (not 50)
  • The formula for making something happen p percent of the time has been corrected
  • I specified the order in which computations should be done
  • I'm also asking for a final summary (the state of the city at the time you leave office)
September 23

There is a talk by Craig Nevill-Manning, of Google on Tuesday, September 28, 3:00 - 4:30, inWu & Chen Auditorium. The title is "Finding needles in a 20 TB haystack, 200 million times per day."

This should be a good talk; I recommend it and I plan to attend myself. I will not have office hours during that time, so I will attempt to be more available the rest of the day.

September 21 Important red tape: Would everyone please check the Sept. 17 Lab Partners list and email me about any changes? Also, please check to make sure you are listed on Blackboard (especially people auditing), and email me if you are not. It would help me to get this information as soon as possible! Thanks.
September 16 The help session will be held in Levine 307 this week (Friday 2-3) and possibly next week, until we find a permanent classroom.
September 14

Pat Palmer will be offering UNIX command and editor workshops in Moore 207, 4:30-6 pm on TR, this week only, for her CIT 593 students.

Students not in her class are also welcome, but will need to sit in back of room or, should there not be enough terminals, look over someone's shoulder.

I recommend attending one of these workshops. GUIs are nice, but sooner or later you will need to learn some basic UNIX, and it's easier if you don't have to pick it up on your own.

September 13 I will not have office hours Tuesday, September 14. Sorry.
September 10 Invitation to a Sunday Social, The Nodding Head Pub and Brewery, 1516 Sansom Street, 7:30 Sunday evening.
September 10

Lab today at 3:00 for everybody (Moore 207).

You should have a gradient login. If you do not, request one from , and indicate whether you are an MCIT student, or in another program but enrolled in CIT 591. If you cannot get a login in time, come to lab anyway.

There is no help session this week. Next week it will probably be Friday 2-3, room to be determined.

September 9

I've posted the Questionnaire and Pre-Test results, but here are the main points:

  • There will only be one lab, 3:00-4:30 Fridays in Moore 207.
  • I haven't yet decided when the beginner's section will be.
  • The average quiz score was 15.6%.
September 3 CIS Dept. New Graduate Student Orientation
Tuesday, September 7, 4:00 PM
Wu and Chen auditorium
MCIT Pizza Bash
on Thursday, September 9, 6:15 PM
Levine 307
(MCIT majors only, please) Free pizza and soda, and a chance to chat with fellow MCIT students!