Spring Semester 2006

Fri May 4
I am almost done with grading the final exams.

Will be working on the final grades and updates of makeups all day today.

Mon May 1
A202 Final Review by Chris Colvard (top of website).

Sat-Sun Apr 29-30
Sent Sunday evening to the distribution list:
Date: Sun, 30 Apr 2006 20:43:02 -0400 (EDT)
From: Adrian German <dgerman@cs.indiana.edu>
To: A202/I211/A598 Spr. 2006 <dgerman@indiana.edu>
Subject: A202/I211/A598 Final Review 

There will be a final review tomorrow (Monday, May 1)
between 2:00pm and 4:00pm in Swain East 140. The review
will be held by Chris Colvard. I spoke to Chris on Friday
and he has a clear idea of what the final will be like and
he will try to focus your final preparations for the final
in the right direction. He will also take any questions
you may have about the Java that you need to know for the
final. As a reminder there will be two problems on the
final, one about the material covered in A202 (see the
Deitel book, your homework assignments, the midterm exam
and the labs) and one on basic "A201 material" (such as
the problems in Lecture Notes Nineteen; we spent many
hours in lectures discussing, solving and reviewing those).

I am currently updating the gradebook and will post a note
on What's New? when the gradebook is completely up to date.

... Adrian

Fri Apr 28
On Monday May 1 Chris Colvard will be holding a review session:

Wed Apr 19
Sent earlier today to the class distribution list:
Date: Wed, 19 Apr 2006 19:44:00 -0400 (EDT)
From: Adrian German <dgerman@cs.indiana.edu>
To: A202/I211/A598 Spr. 2006 <dgerman@indiana.edu>
Subject: A202/I211/A598: Practical Exam, Grades and the End of the Semester

First off apologies if you are not (or if you are not any longer) in
A202/I211 or A598. This message wants to let you know that there is an
exam in labs tomorrow: the practical make-up. Problems listed in Lecture
Notes Nineteen are very good practice. Like Tuesday we will offer 5 pts
on the final if you come and work one problem in front of the class. Both
Patrick and Matt did very well on Tue and James and Thomas are likely to
be the guest stars tomorrow (it's up to them). Jeff also announced he
might be up for such a problem, so let's look forward to tomorrow's class
for the review and a chance to get 1/20 of the final exam ahead of time.

I also want to encourage you to make an appt if you want to discuss your
grades or the class in general. Times until the end of the semester have
been posted, just choose the earliest you can make and sign in:


I have posted all the grades I have ever received. Please check the
Postem gradebook and report discrepancies to your AIs. Any make ups are
to be scheduled with me. They'll just grade Homework Ten and will be done
for the semester. I am looking forward to help you make up anything, but
it has to be done in person, by making an appt through the script above,
or send me e-mail (reply to this message) if you need any type of special
accommodations (times don't match and such).

Thanks for your hard work so far and please let me know if you need any
help, or if you have any questions just let me know.

... Adrian

Tue Apr 18
Practical Exam on Thursday in lab.

More details will be sent by e-mail later today.

Problems from Lecture Notes Nineteen could also appear on the final.

Sat-Mon Apr 15-17
Individual appointments for the next two weeks can be scheduled through this script.

Thu-Fri Apr 13-14
Code developed in class on Thu has been posted as Lecture Notes Twenty-Six.

Grade reports have been distributed in class on Thu.

They need to reach me back through your lab instructors.

Wed Apr 12
Ancillary materials posted for Homework Ten (mostly images and such).

Mon-Tue Apr 10-11
Here's an old A348 problem, read it and think about it.

The minute paper on Tue will be based on it.

1. (10 points) Write a Perl program that

Here's an example

school.cs.indiana.edu%cat file
If a packet hits a pocket on a socket on a port,
and the bus is interrupted and the interrupt's not caught,
then the socket packet pocket has an error to report. 
      -- Programmer's traditional nursery rhyme. 
(I)f (a) p(a)ck(e)t h(i)ts (a) p(o)ck(e)t (o)n (a) s(o)ck(e)t (o)n (a) p(o)rt,
(a)nd th(e) b(u)s (i)s (i)nt(e)rr(u)pt(e)d (a)nd th(e) (i)nt(e)rr(u)pt's n(o)t c(a)(u)ght,
th(e)n th(e) s(o)ck(e)t p(a)ck(e)t p(o)ck(e)t h(a)s (a)n (e)rr(o)r t(o) r(e)p(o)rt. 
      -- Pr(o)gr(a)mm(e)r's tr(a)d(i)t(i)(o)n(a)l n(u)rs(e)ry rhym(e). 

Sun Apr 9
New template posted (in Postem, under A202-0205) for grades covers all semester.

Grades will show up in the template by Tuesday morning (all the grades I have).

We're preparing ourselves to issue a tentative final grade before the final exam week.

Thu-Sat Apr 6-8
Lecture notes from Thu posted, template for Homework Nine reviewed.

Notice that the template from the book forgets to create a new rectangle.

The fixed template is here (thanks to Fulya for noticing this, as one may have, too, already).

In the code above the elevator is placed somewhat incorrectly (but almost correctly) on purpose, for your intervention.

(Also, I made the elevator blue).

Wed Apr 5
Tuesday lecture notes posted (under Lecture Notes Twenty-Three).

Tue Apr 4
I have received 33 (thirty-three) minute papers. Of these:

So it's now due on Sunday, April 9.

Code developed in class today, plus a few more to be posted in the evening.

Thu-Mon Mar 30-Apr 3
Notes for last week, grades to be posted soon.

Here's the score distribution for the practicals:

A+  96-100   
A   90- 95   *************************
A-  88- 89   *
B+  86- 87   
B   80- 85   **
B-  78- 79   *
C+  76- 77   
C   70- 75   ******
C-  68- 69   
D+  66- 67   *
D-  55- 65   *
F    0- 54   **********

Wed Mar 29
Practical Exam in labs today, here are the rules for this test.

Wed Mar 29
Last chance for a review before the Practical Exam: tomorrow, in class.

Tue Mar 28
Page 723 in your text has a summary on sequential access to files.

Here's a basic copy program (note the call to close() at the end):

import java.io.*;

class Two {
  public static void main(String[] args) throws Exception {
    String fileName = args[0];
    String fileOut = args[1];
    FileReader reader = new FileReader(fileName);
    FileWriter writer = new FileWriter(fileOut, true);
    BufferedReader buffer = new BufferedReader(reader);
    PrintWriter printer = new PrintWriter(writer);
    String line = buffer.readLine();
    while (line != null) {
      line = buffer.readLine();

Mon Mar 27
Homework Eight is due tomorrow, it's very simple, as demonstrated in class last Thu.

It can be as short as 12-14 lines of code properly placed in the template provided.

You need to understand the template inside out, however (it's based on your ShippingHub lab anyway).

Fri-Sun Mar 22-26
Minute paper for Thu was to look at the list of review problems and e-mail me a "top ten list".

More details in the e-mail sent Sun morning:

Date: Sun, 26 Mar 2006 08:44:08 -0500 (EST)
From: Adrian German <dgerman@cs.indiana.edu>
To: A202/A598/I211 Spr. 2006 Distr. List <dgerman@indiana.edu>
Subject: A201/A598/I211 Thu 03/23 minute paper and 03/30 Practical Exam 

Dear A202/A598/I211 Friends,

The minute paper for Thu consists of an e-mail message that you need
to send me (just reply to this message) indicating the "top ten most
difficult/weird problems" of the problems posted for your review, at
the URL for Lecture Notes Nineteen:


Please review the problems and list them Letterman style; no. 10 is the
most approachable of the most difficult, no. 9 is harder, and so on all
the way to no. 1, which would be the most difficult of them all.

I will summarize your answers and post a cumulative "top ten list," which
would give us material to review on Tue and Thu.

I remind you that this Thu in labs we have a Practical Exam. The exam will
consist of one problem---which will be very similar to one of the problems
posted for your review. So, what better way to prepare for such an exam if
not identifying the troublemaker problems early enough, so we can discuss,
and understand them completely.

Please send the list to me Mon night at the latest.

More about the Practical Exam on Tue, in class, based on the cumulative 
top ten list we will produce.

... Adrian

Thu Mar 23
Lab Notes for today posted.

Wed Mar 22
The code developed in class on Tue appears under Lecture Notes Twenty.

In class tomorrow we will discuss selected problems from Lecture Notes Nineteen.

The Lab Notes for the week will also be posted a bit later today.

Tue Mar 21
Gradebook updated a bit.

Lecture Notes Nineteen have started a review of basic skills.

Mon Mar 20
Lecture Notes 17-18 and Lab Notes Nine have been updated.

Sat-Sun Mar 11-19
Have a great Spring Break!

Thu-Fri Mar 9-10
Notes for Thu (containing the programs discussed in class) to be posted soon.

Tue-Wed Mar 7-8
What's Due? page updated to the end of the semester.

Fri-Mon Mar 3-6
Here's a solution for the exam problem. Grading scale for the exam:

interface: 10 points
listener structure: 10 points
listener constructor: 10 points
initializing and assigning listener: 5 points
listener logic: 20 points
properly enabling/disabling buttons: 10 points
dispensing the right product: 10 points
giving change: 20 points
safety margin: 5 points (a 95 is the highest A)

Thu Mar 2
Exam today in class has been posted.

Finish it in lab also make sure you convert the microwave oven program.

Wed Mar 1
Announcement sent to class distribution list.

Mon-Tue Feb 27-28
I am in Washington, DC, attending a workshop and returning Tue night.

Sat-Sun Feb 25-26
There will be a review and help session in anticipation of the exam on Tue, in class.
Fulya Erdinc will be teaching Tuesday's class and will be answering all your questions.

Fri Feb 24
Code developed in class on Thu (three programs).

Thu Feb 23
Notes for the lab today have been posted.

Wed Feb 22
Program written in class on Tue (it's 15.12 from the text):
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class Nine {
  public static void main(String[] args) {

    JFrame f = new JFrame();

    Container c = f.getContentPane();

    JButton b = new JButton();
    b.setBounds(50, 50, 100, 30);

    Listener m = new Listener();


    f.setSize(400, 400);


class Listener implements ActionListener {
  int[] frequencies;
  int total;
  public void actionPerformed(ActionEvent e) {
    int n = (int)(Math.random() * 6) + 1;
    int m = (int)(Math.random() * 6) + 1;
    this.frequencies[n-1] += 1;
    this.frequencies[m-1] += 1;
    this.total += 1;
    System.out.println("(" + n + ", " + m + ") " + total);
  Listener() {
    this.frequencies = new int[6];
  void report() {
    for (int i = 0; i < this.frequencies.length; i++) {
      System.out.print(this.frequencies[i] + " ");

Tue Feb 21
Things to discuss in class today:

A program that we might use in class.

Fri-Mon Feb 17-20
The program we wrote in class on Thursday.

Grades updated, posted, include the latest minute papers, labs, some Homework Four grades.

And a program from last week that we need to revisit.

Thu Feb 16
Instructions for the labs today, including grading guidelines.

Wed Feb 15
Code developed on Tue in class.

Tue Feb 14
Please sign up for any makeups you need/want to take this week and the next.

Mon Feb 13
Lecture Notes for the week posted.

Sun Feb 12
Lab Notes Six sketched, office hours for Monday unfortunately cancelled.

Sat Feb 11
Thu we covered most of Lecture Notes Ten.

The code we developed can be found here.

Fri Feb 10
Don't forget Homework Four is due on Tuesday.

Grades will be updated tonight.

Thu Feb 9
Lecture Notes Ten, Lab Notes Five posted.

Wed Feb 8
Plans for this week's labs (tomorrow, Thu).

Mon-Tue Feb 6-7
Programs developed in class on Tue: Quiz.java, Two.java.

Notes for last week, this and next to be posted soon.

Sun Feb 5
Updated due dates for the upcoming homework assignments:

Assignment Now Due Accepted Late Until
Homework Three Tue 02/07 11:45pm Wed 02/08 10:00am
Homework Four Tue 02/14 11:45pm Wed 02/15 10:00am
Homework Five Tue 02/21 11:45pm Wed 02/22 10:00am
Homework Six Sun 02/26 11:45pm Mon 02/27 10:00am

Fri-Sat Feb 3-4
The result of the transformation illustrated in class on Thursday.

Thu Feb 2
A design diagram that wouldn't work for the Craps game.

Wed Feb 1
Lab notes for this week discussed Tue in class, posted.

Tue Jan 31
Today in class we apply a similar strategy to Tutorial 11, but more on the computer.

Here's a basic diagram (and a more specific flow chart) of how the game works.

Here's a picture of the game, being played.

(Images can be found here.)

Fri-Mon Jan 27-30
Lecture Notes Six posted, implement the design discussed in class last Thu.

Thu Jan 26
Lab notes for today posted.

Wed Jan 25
Code for the minute paper of yesterday:
class Point {
  int x, y;
  Point() { }
  Point(int x, int y) { this.x = x; this.y = y; }
  static Point origin = new Point();
  double distanceTo(Point other) {
    return Math.sqrt(Math.pow(this.x - other.x, 2) +
                     Math.pow(this.y - other.y, 2));
  public static void main(String[] args) {
    Point one = new Point(3, -2);
The point is: the blueprint is entirely distinct from the group of static members.

Code for the program that we developed in class:

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

class One {
  public static void main(String[] args) {

    JFrame f = new JFrame();

    Container c = f.getContentPane();


    JButton b = new JButton();
    b.setBounds(20, 20, 80, 20);

    JTextField t = new JTextField();
    t.setBounds(120, 20, 80, 20);

    JTextArea a = new JTextArea();
    a.setBounds(20, 100, 200, 200);

    Listener m = new Listener(a, t);

    f.setSize(400, 400);



class Listener implements ActionListener, KeyListener {

  JTextArea a;
  JTextField t;

  Listener(JTextArea a, JTextField t) {
    this.a = a;
    this.t = t;

  public void actionPerformed(ActionEvent e) {
    a.append(t.getText() + "\n");

  public void keyTyped(KeyEvent e) { }
  public void keyPressed(KeyEvent e) {
    System.out.println("key pressed in text field");
  public void keyReleased(KeyEvent e) { }

Tue Jan 24
Lecture notes for today posted.

Mon Jan 23
Homework Assignments updated, posted through the end of the semester.

Sun Jan 22
Grades, lab/lecture attendance updated early Saturday (go into A202-0205).

Schedule of office hours is now final.

Sat Jan 21
Slides/diagrams shown last Tuesday (briefly) in class:

Fri Jan 20
Here's the second program developed in class on Thu, finished:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

class Ten extends JFrame {
   JButton up, down;
   JLabel a;
   Ten() {
     Container c = this.getContentPane();
     this.a = new JLabel();
     this.a.setBounds(80, 80, 140, 60);

     this.up = new JButton();
     this.up.setBounds(80, 140, 120, 60);

     this.down = new JButton();
     this.down.setBounds(210, 140, 120, 60);

     Broker b = new Broker(this.a, this.up, this.down);

   public static void main(String[] args) {
     Ten n = new Ten();
     n.setSize(400, 400);

class Broker implements ActionListener {
   JLabel a;
   JButton up, down;
   Broker(JLabel a, JButton up, JButton down) {
     this.a = a;
     this.up = up;
     this.down = down;
   public void actionPerformed(ActionEvent e) {
     Rectangle r = a.getBounds();
     if (e.getSource() == this.up) {
       r.translate(0, -1);
     } else {
       r.translate(0, 1);

The first one was just an invitation to exploration and research:

import java.awt.*;
import javax.swing.*;

class Six {
   public static void main(String[] args) {
     JFrame f = new JFrame();
     Container c = f.getContentPane();
     JLabel a = new JLabel();
     a.setBounds(80, 80, 140, 60);


     f.setSize(400, 400);
Thu Jan 19
Code for all labs, for the entire semester, has been posted.

Wed Jan 18
Code developed in class yesterday.

Tue Jan 17
Schedule of office hours:
Who Where When
Adrian German LH201D Mon, Wed 9:30am-12:30pm
Adrian German LH201D Tue, Thu 9:30am-10:30pm
Sara Teresa Martin LH112 Wed 12:30-2:30pm
Chris Colvard LH201I Mon, Wed 10:00-11:30am
Andrew J. Hinz LH112 Thu 9:10-11:00pm
Fulya Erdinc LH201D Thu 3-5pm

Sun Jan 15
Lecture notes for this week have been updated.

Sun Jan 15
Lab Notes Two posted, along with supporting code.

Sat Jan 14
Lab/lecture attendance has been updated (go into A202-0205).

Fri Jan 13
Here's the code we developed in class on Thursday.

Thu Jan 12
Lecture Notes Three have been posted.

Wed Jan 11
  1. PostEm will soon be added to the set of tools available in OnCourse.
    Until then attendance is posted here (go into A202-0205).

  2. Here's the code we developed in class yesterday.
    Recall how the frame must me made visible only at the end?
    And the size should be determined before that?

Tue Jan 10
Class information from the Registrar's.

Notes for the week posted last night.

Office hours, additional information about class will follow soon.

Mon Jan 9
Class starts tomorrow, here's the schedule for this semester:
AI/UI Availability Lab size
LEC 11:15am-12:30pm TR LH102 German
LAB 12:45pm-2:40pm R SE045 Fulya Chris* 25 - 6 = 19
LAB 2:55pm-4:50pm R SE045 Fulya Sara Chris** 24 - 16 = 8
LAB 5:05pm-7:00pm R LH025 Fulya Sara Chris** 18 - 0 = 18 (CLOSED)
LAB 7:15pm-9:10pm R LH025 Fulya Sara Andy Chris 18 - 10 = 8

Updated by Adrian German for A202/A598 and I211