Problems to be used to either make up or earn extra points.

Spring Semester 2004

A201 Web-Based Bulletin Board

Thu-Sun Apr 29- May 2
Date: Sat, 1 May 2004 21:58:02 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: Last minute appts. for the finals week. 

Dear A201/A597/I210 friends,

Times when I will be available for individual appointments next week
are listed at:

If you need to see me please choose a time and I'll be happy to see you
any listed time next week even after the final exam (Sat is the last day
when we can meet). I'll also start sending individual messages soon.

Hope your weekend is coming along fine I wish you a great finals week.

... Adrian

Here's a set of problems that should help you prepare for the final.

Tue-Wed Apr 27-28
Final Exam May 4 (5-7pm) in Rawles Hall room 100.

Many thanks to Joe G. Garcia for bringing up the cartoon above.

Fri-Mon Apr 23-26
Check this to find out when the final will be.

Thu Apr 22
Date: Thu, 22 Apr 2004 09:15:07 -0500 (EST)
From: Adrian German 
To: A201 Spr. 2004 Distr. List <>
Cc: Shashikant Penumarth Rao <>
Subject: makeup exam in class today

Dear A201 Friends,

Shashi and Steve will be proctoring the exam today. I am off to Boston for
a conference (NKS 2004, and
presentation and will be returning Sun night. Many thanks to Shashi and Steve
for their generous help. Good luck with the exam and I'll see you next week.

... Adrian

Tue-Wed Apr 13-14
Here's the code developed in class on Tue.

First example:

 <applet code=One.class width=400 height=400>

import java.applet.*;
import java.awt.*;

public class One extends Applet {

  public void paint(Graphics g) {
    g.setColor(new Color((float)1.0,
    g.fillOval(30, 30, 50, 50);
    g.drawOval(30, 30, 50, 50);

The second example:
 <applet code=Two.class width=400 height=400>

import java.applet.*;
import java.awt.*;

public class Two extends Applet {

  Circle[] circles;

  public void init() {
    circles = new Circle[100];
    for (int i = 0; i < circles.length; i++) {
      circles[i] = new Circle( new Color( (float)Math.random(),
                                          (float)Math.random()) ,
                               (int)(Math.random() * 400),
                               (int)(Math.random() * 400),
                               (int)(Math.random() * (80 - 20) + 20)

  public void paint(Graphics g) {
    for (int i = 0; i < circles.length; i++)


class Circle {
  Color c;
  int x, y;
  int radius;
  Circle(Color c, int x, int y, int r) {
    this.c = c; this.x = x; this.y = y; this.radius = r;
  void draw(Graphics g) {
    g.fillOval(this.x, this.y, this.radius * 2, this.radius * 2);
    g.drawOval(this.x, this.y, this.radius * 2, this.radius * 2);

Mon Apr 12
Lab Assignment Ten is due next Monday Apr 19.

Sun Apr 11
Practicals finally graded and grades posted.

Fri-Sat Apr 9-10
Grades for Midterm Two posted. Practical Exam grades to follow.

Here's the change of code worked out in class on Thu:


class Two {
  public static void main(String[] args) throws Exception {
    BufferedReader c = new BufferedReader(new InputStreamReader(;
    String line;
    System.out.print("What size? ");
    int n = Integer.parseInt(c.readLine());
    Team[] a = new Team[n];
    for (int i = 0; i < n; i++) {
      System.out.print("Name? ");
      String name = c.readLine();
      System.out.print("Pts.  ");
      double points = Double.parseDouble(c.readLine());
      a[i] = new Team(name, points);
    // done entering data here
    String choice;
    do {
      System.out.print("how> ");
      choice = c.readLine();;
      Two.sort(a, choice);;
    } while (! choice.equals("none"));
  static void show(Team[] a) {
    for (int i = 0; i < a.length; i++)
      System.out.println(a[i].name + " " + a[i].perc);

  static void sort(Team[] a, String choice) {
    boolean sorted;
    do {
      sorted = true;
      for (int i = 0; i < a.length - 1; i++)
        if (choice.equals("points") && a[i].perc < a[i+1].perc ||
            choice.equals("name") && a[i].name.compareTo(a[i+1].name) > 0 
           ) {

          sorted = false;
          Team temp = a[i];
          a[i] = a[i+1];
          a[i+1] = temp;

      System.out.println("I am sorting...");
    } while (! sorted);


Thu Apr 8
Here's an old Lab Twelve.

Date: Thu, 8 Apr 2004 09:46:42 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201 Update (end of semester)

Only three more weeks to the end of the semester. We start applets today
(graphics, inheritance, event handling) but we should be more focused on
the upcoming make-ups. A review of Chapters 1, 2, 3, 4, 5, 6, 10 and 11,
in Wu is required to do well on the second midterm makeup and the maekup
for the practical exam (as well as on the final).

I also opened a drop box for late assignments and such where you can put
anything that you had otherwise sent to me by e-mail (or did already) so
I don't delete it by mistake (or in case it doesn't reach me). Use it to
record your interest in making up anything or all in this class.

I will be visiting labs next week I plan to have individual appointments
with those of you I perceive at (some sort of) risk in this class so you
can get some credit for any extra work you might be putting in---between
now and then.

... Adrian
Lab Notes Ten posted here's what you're aiming for.

Mon-Wed Apr  5-7
Here's the code developed in class on Tuesday.

Part One (the basics):

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

    int[] a = new int[args.length];

    for (int i = 0; i < a.length; i++) {
      a[i] = Integer.parseInt(args[i]);
  static void show(int[] a) {
    for (int i = 0; i < a.length; i++)
      System.out.print(a[i] + " ");

  static void sort(int[] a) {
    boolean sorted;
    do {
      sorted = true;
      for (int i = 0; i < a.length - 1; i++)
        if (a[i] > a[i+1]) {
          sorted = false;
          int temp = a[i];
          a[i] = a[i+1];
          a[i+1] = temp;
      System.out.println("I am sorting...");
    } while (! sorted);

And here's Part Two (closer to the assignment):
class Two {
  public static void main(String[] args) {
    ConsoleReader c = new ConsoleReader(;
    String line;
    System.out.print("What size? ");
    int n = c.readInt();
    Team[] a = new Team[n];
    for (int i = 0; i < n; i++) {
      System.out.print("Name? ");
      String name = c.readLine();
      System.out.print("Pts.  ");
      double points = c.readDouble();
      a[i] = new Team(name, points);
    // done entering data here;

  static void show(Team[] a) {
    for (int i = 0; i < a.length; i++)
      System.out.println(a[i].name + " " + a[i].perc);

  static void sort(Team[] a) {
    boolean sorted;
    do {
      sorted = true;
      for (int i = 0; i < a.length - 1; i++)
        if (a[i].perc > a[i+1].perc) {
          sorted = false;
          Team temp = a[i];
          a[i] = a[i+1];
          a[i+1] = temp;
      System.out.println("I am sorting...");
    } while (! sorted);


class Team {
  String name;
  double perc;
  Team(String n, double p) { = n;
    this.perc = p;

Fri-Sun Apr  2-4
Date: Fri, 2 Apr 2004 20:36:07 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201 Lab Nine 

Dear A201/A597/I210 friends,

I would like to remind everybody that Lab Nine help was offered (and
posted under What's New? for the day that followed) on Mar 11--which
was the Thu before the Spring Break. Lab Nine is due Mon (Apr 5) and
should you experience any problems w/ it I suggest you check out the
news for Fri Mar 12.

Tue we will offer help with Homework Six and discuss arrays sorting,
both bubble sort and selection sort. I hope you have a great weekend
and we will see you on Tue in class (with a new episode of Mr Bean).

Take care and all the best.

... Adrian

Thu Apr  1
Here's the exam you took last night.

Homework Six has been finalized.

Wed Mar 31
Midterm Exam Two in Rawles 100 today 7-9pm.

There won't be a new lab this week as we try to catch up with everything.

Lecture on Thu will help with Lab Nine and Homework Five.

Here are the solutions to the Practical Exams:

Tue Mar 30
Date: Tue, 30 Mar 2004 13:15:40 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: midterm review today in class

The single most important thing to review for the exam tomorrow is the set
of notes entitled "Java Fandango" (also known as Lecture Notes Nineteen).

I will be covering that today in class.

Also the exam is now with Maxi (Multiplicating Services) and here's how it
came out:

     *    32 questions as in a multiple-choice test

     *    except you need to provide (write or fill in) the answer.

Unlike the midterm exam you don't need to explain your reasoning process
(unless you want to, in which case partial credit can be given). You just
have to write the answer, which is very short. I doubt you will need any
extra paper for the answers, but it would be good to have some extra paper
handy for any calculations you might have to make.

So it's a short-answer test that looks very much like a multiple-choice
test. And the best thing to review/study would be Lecture Notes Nineteen.

There will be a midterm two makeup in class April 22 but I think you can
do well tomorrow if you study Lecture Notes Nineteen.

See you in class. Exam is open-book, open-notes, but individual work.

... Adrian

P.S. It looks like we won't use our remote pads in class today, after all.
Since the exam is short-answer. It's a lot harder (and slower) to grade it
that way but I felt that would be the best approach for the test tomorrow.
So come with an open mind and we will review for tomorrow following the
posted Lecture Nineteen Notes. See you in class!
The single most important set of notes to review for tomorrow is Lecture Notes Nineteen (Java Fandango).

Date: Mon, 29 Mar 2004 20:31:58 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201 Midterm Two Wed 3/31 Rawles 100 (7-9pm)

Please bring your remote pads tomorrow so we can turn the first part of
the lecture into a review for the exam. Midterm One topics plus arrays,
multiple-choice, open book and open notes, & individual work. Otherwise
the week will discuss Homework Assignments Five, Six as well as sorting
algorithms for arrays (bubble sort and selection sort).

Our plan is to test our ability to produce a final grade quickly, so we
will use this week's results (practical midterm two and two most recent
assignments: homework three and four) to produce an aggregate grade for
you for Fri-Sun this coming weekend. A letter grade.

There will be a makeup for Midterm Two on Thu April 22 in class.

... Adrian
Examples of past midterm two (but also final one) kind of exams:

Mon Mar 29
Your overall grade for this class will be posted Fri night this week.

It will include the Practical Exam and the Second Midterm.

And hopefully as much of Homework Three and Four as possible.

Sat-Sun Mar 27-28
Sunday 3:22pm I have finished grading all makeups.

I now need to just enter the grades (should go quickly).

(outdated) ... Saturday evening 9:59pm I have

Here are the practical problems of Thursday-Friday:

You have until Sunday to submit revised source code to OnCourse.

The paper will count about 60% and the submitted code about 40%.

Monday I post the solutions so we see how the problems could be done.

Thu-Fri Mar 25-26
Practical Exam in labs. Check the notes when you go to the lab.

Here's the link to the StringTokenizer API and the message of Wednesday:

Date: Wed, 24 Mar 2004 22:53:18 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201/A597/I210 Practical Exam 

Dear A201 Friends,

Homework Four (handed out in class yesterday) has been updated and lots
of explanations and in some cases code have/has been provided. It is still
the best preparation for the Practical Exam. The dropbox for Homework Four
will stay open until Sunday but it would be a mistake to not use it to study
for the Practical Exam and wait until Saturday to start looking at it.

A Word document with all explanations is what is needed for Homework Four.

Please come and take the Practical Exam regardless of how you feel about
how much you know what chances you have and so one. There will be a makeup
for the Practical at the very end of the semester during the last lab. But
it would be better to do well on it this week, wouldn't it? I am sure it
would. So let's give it a try.

Good luck with all your preparations.

... Adrian

P.S. If this message reaches you in error please let me know and I will
remove your username from the list (with apologies). Thanks a lot and all
the best to you.

Wed Mar 24
I am working on adding content (hints and suggestions) to Homework Four.

As announced in lecture yesterday that's what the Practical Exam will be like too.

I am sure I will be done by noon.

Mon-Tue Mar 22-23
Date: Tue, 23 Mar 2004 10:36:42 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201 update (week of March 25-26). 

Dear A201/A597/I210 Friends,

My goal this week will be to make sure everybody is ready for the exam
on Thu/Fri (Practical Exam in labs). For this reason the lectures will
be focused this week on reviewing Homework Three but we'll also talk a
bit about arrays perhaps in the context of sorting.

Since we can't schedule any review session and because we're fresh out
of the Spring Break the lecture notes for this week review some of the
material covered thus far with an eye forward (Tue: Java Fandango) and
try to help with the assgt. on arrays posted before the break (the add
problem, Thu notes).

To make sure we're able to focus on the practical exam (open book, and
open notes as before) we make the following changes:

a) Homework Four (listed with a due date of today) becomes Homework 5,
and is due next week.

c) the new Homework Four will be posted right away and it will ask you
to review the essential elements in all 16 problems of Homerwork Three
to prepare for the exam. Thus lectures this week will be used only for
work on the new Homework Assignments Four and Five. I'm sure this will
be useful to all of us since this is mostly a review and an extension.

If you have any questions or need help please let me know. No lab is due
this week. Mr. Bean episode will be played before the lecture today. The
remote pads won't be needed this week unless stated otherwise.

Hope everybody is doing well and ready to catch up and do well and have
a great end of semester in A201/A597/I210. (I'm still grading the makeups
and I am sure I will have the grades posted tomorrow morning). I've been
slowed down by grading in A348/A548 (they had taken their midterm right
before the break and it consisted of two parts and there was a lot to do).

... Adrian

Sat-Sun Mar 13-21

Fri Mar 12
Here's the code developed in class yesterday:
class LabNine {
  public static void main(String[] args) {
     int[] a;
     a = new int[10];
     for (int i = 0; i < a.length; i++) {
       a[i] = (int)(Math.random() * 10 + 1);
     System.out.print("3 occurs " + count(3, a) + " times in ");
     if (contains(a, 3)) {
       System.out.print("3 appears in the array ");
     } else {
       System.out.print("3 does not appear in the array ");
     System.out.print(findMax(a) + " is the biggest number in ");
  public static int findMax(int[] a) {
    int max = a[0];
    for (int i = 0; i < a.length; i++)
      if (a[i] > max)
        max = a[i];
    return max;
  public static void show(int[] a) {
     for (int i = 0; i < a.length; i++)
       System.out.print(a[i] + " ");
  public static int count(int value, int[] a) {
    int count = 0;
    for (int i = 0; i < a.length; i++)
      if (a[i] == value)
        count += 1;
    return count;
  public static boolean contains(int[] a, int value) {
    return !(count(value, a) == 0);
Thu Mar 11
Today in class we will be discussing

Here's some help with the Turtle problem.

class Alpha {
    public static void main(String[] args) {
        Alpha alpha = new Alpha(); 
        Point point = new Point(6, 6);

        for (int i = 0; i < 90; i++) {
	    System.out.println("The relative angle is: " + 
			       alpha.angleWith(point) + " degrees.");
	    System.out.println("Sensing target: " + alpha.senseTarget(point)); 

	for (int i = 0; i < 30; i++) {
	    System.out.println("The relative angle is: " + 
			       alpha.angleWith(point) + " degrees.");
	    System.out.println("Sensing target: " + alpha.senseTarget(point)); 


    int direction; 
    double x, y; 

    double senseTarget(Point point) {
	double d = this.distanceTo(point); 
	return d * Math.abs(this.angleWith(point) - 180) / 180.0; 

    double distanceTo(Point point) {
	double dX = this.x - point.x; 
	double dY = this.y - point.y; 
	return Math.sqrt(dX * dX + dY * dY); 

    void rotate(int degrees) {
	this.direction += degrees; 
	this.direction %= 360;; 

    void moveForward() {
	this.x += Math.cos(Math.toRadians(direction)); 
	this.y += Math.sin(Math.toRadians(direction));; 

    void report() {
	System.out.println("I am at: (" + ((int)x * 100)/100.0 + ", " + 
                                        ((int)y * 100)/100.0 + ") " + 
			   "My direction is: " + direction + " degrees. ");

    int angleWith(Point point) {

	    a = Math.cos(Math.toRadians(direction)),
	    b = Math.sin(Math.toRadians(direction)); 

	    u = point.x - this.x,
	    v = point.y - this.y;

	double size = Math.sqrt(u * u + v * v);  

	u /= size; 
	v /= size; 

	return (int) (Math.toDegrees(Math.acos(a * u + b * v))); 



class Point {
    int x, y; 
    Point (int a, int b) {
	this.x = a; 
	this.y = b; 

Wed Mar 10
Date: Wed, 10 Mar 2004 12:04:14 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: Homework Three, Lab Eight

All dropboxes will stay open this week until Friday midnight. That
means all due dates are extended till then (Homework Three and Lab
Eight included). We discussed Lab Eight yesterday in class. I will
go over arrays and 2-3 of the more difficult problems in Homework
Three tomorrow.

There will be a long episode of Mr. Bean tomorrow. It will start
5' before lecture as we come in (half of it) and we will play the
second half 35' minutes into the class (during a 5' break).

I am working on the grades for the midterm makeup and such and
hope to post them soon. If you have questions or need help please
let me know. I might be slow with e-mail but I like reminders and
will eventually get back to everybody. Thanks and all the best.

... Adrian

Tue Mar 9
Slides for the exam last night.

Mon Mar 8
Midterm One Makeup Exam tonight 7-9pm in Swain West 119.

Sat-Sun Mar 6-7
Date: Sun, 7 Mar 2004 12:48:25 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: Midterm One Makeup Exam on Monday

Dear A201/A597/I210 Friends,

Please make sure you register for the makeup exam in OnCourse. Please
practice (with) the quizzes posted there (in OnCourse). Here's a list
of references from the book to help you review:

from chapter 9 pp. 516-530 (ascii table is on page 517, page 527 talks
about the use of .equals(...) vs. == when comparing strings, and so does
p. 541) also pp. 541-542.

from chapter 6 pp. 316-334 are useful and basic (while, do-while, loop
and a half). pp. 335-350 cover for loops, nested loops like in lab 6, and
p. 337 even has a cannonball/watermelon simulation. Pp. 350-356 talk about
random number generators and one of the problems in Homework Three's being
developed step by step (at the end of the chapter).

chapter 6 ends with a discussion of a method that is closely related to
the what() method in Lab Five: factorial. We will see on Tuesday how the
use of recursion greatly simplifies some solutions.

from chapter 5 p. 237 explains the use of curly braces to define blocks
of statements. Pp. 234-244 discuss if's in general. Boolean expressions
and variables are on pp. 244-250 followed by more examples (nested ifs,
and a discussion on comparing object references vs. objects' contents).
Note the table at the bottom of page 244, deMorgan's law (p. 246), and
the table of precedence on page 247. (The switch statement is described
on p. 269, it has some limitations, but is also very useful at times, so
it's good to know).

chapter 4 is really basic and fundamental: it's about defining your own
types (your own classes) and putting instance or static members in them
as part of the design process, then using that. This chapter must be read
at about the same time we read pp. 16-23 in chapter 1. The chapter is OK
especially some of the diagrams are useful. One needs to mainly know about
instance variables, instance methods, local variables and parameters, and
constructors (as initialization procedures). P. 156 nicely examines the
syntactic elements in the definition of a method. P. 155 diagrams the
fact that every instance has its own copy of an instance variable. P. 163
discusses constructors (including their syntax). Visibility modifiers are
discussed on p. 166-170. Local variables and parameters (for methods, of
course) are discussed on pp. 171-179. Methods who behave in a certain way
acquire a specific name: mutators and accessors are described on p. 179
and the following. The basic tenet that in programming we really don't
have anything but variables and methods (named generalized expressions)
is given a bit of practice in section 4.6 (pp. 189-200). Notice that we
indeed don't use anything but variables and methods, and that they key
is really to locate them (using object references for instance members,
whereby the this keyword becomes quite easy to understand, and class
names for static members). Names of values of reference types really act
as pointers. Objects are containers. Classes are containers too but they
are also factories (you can produce objects with them since they have a
blueprint inside, composed of all the instance members listed in it).

chapter 3 should look extremely basic to you by now. Its main focus is
on values, expressions, variables (named locations) and simple programs,
composed mainly of assignment statements.

I hope this overview will help you. Next week we start arrays (ch. 10).

Hope to see you tonight at 7-8pm in SW119 (if you have questions).

Please don't forget to register for the makeup in OnCourse.

The makeup is tomorrow in SW119 (7-9pm). Hope to see you then, if not---
Tuesday in class.

... Adrian
Fri Mar 5
Bjorn Ottesen is our new Student of the Week

And here's a picture of John O'Brien who suggested this:

class JohnsIdea {
  public static void main(String[] args) {
    String amount = "3"; 
    if (amount.length() < 3) {
      for (int i = 3 - amount.length(); i > 0; i--) 
        amount = "0" + amount; 
    String partOne = amount.substring(0, amount.length() - 2); 
    String partTwo = amount.substring(amount.length() - 2); 
    System.out.println( partOne + "." + partTwo );     
Thu Mar 4
Midterm One Makeup is on Monday March 8 (7-9pm) in Swain West 119.

A review for the exam will be held on Sunday March 7 (7-8pm) in Swain West 119.

Date: Thu, 4 Mar 2004 11:34:52 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201/A597/I210 Update

Dear A201/A597/I210 Friends,

There's a Midterm One Makeup on Monday March 8, 2004 at 7pm
(lasting for two hours) in Swain West 119. I will send a few
more reminders as we get closer to the date and I'll post more
information on what to review/practice and such for the test.

I'll come through all the labs today and tomorrow and mostly
hope to reach those that I didn't manage to see in individual
appointments the weeks before. So, I am sure, we will see you
soon. If you have any questions or need help please let me know.

... Adrian
Also, two more quizzes have been posted in OnCourse.

Wed Mar 3
New web board now authenticates so we will eliminate spam.

Lab Notes Seven contain Lab Assignment Seven.

Here are the slides from yesterday.

Fri-Tue Feb 27- Mar 2
Midterm One Makeup is Monday March 8 in Swain West 119 (7-9pm).

Problems in Homework Three being updated (more information being added).

A set of slides for Tuesday lecture will be posted here soon.

Thu Feb 26
Here's the code we developed in class today:

public class Nim {
  public static void main(String[] args) {
    Pile pile = new Pile(32);
    ConsoleReader c = new ConsoleReader(;
    System.out.println("Welcome. You're playing with a pile of size: " + pile.size());
    while (pile.size() > 1) {
      int user;
      do {
        System.out.print("How many marbles do you want to take: ");
        user = c.readInt();
      } while(! pile.remove(user));

public class Pile {
  int balance;
  Pile(int initial) {
    this.balance = initial;
  int size() {
    return this.balance;
  boolean remove(int amount) {
    if (amount > 0 && amount <= this.size() / 2) {
      this.balance = this.balance - amount;
      System.out.println("Move is OK. Height is now: " + this.size());
      if (this.balance == 1) System.out.println("Game over. You won.");
      return true;
    } else {
      System.out.println("Not good. Try again. Pile is: " + this.size());
      return false;
Here's a set of slides for one of the current exercises in OnCourse.

We'll discuss it in class tonight, a lot more will be posted over the weekend.

Wed Feb 25
Message sent to the list Wed evening:
Date: Wed, 25 Feb 2004 17:59:40 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201/A597/I210 Update

Dear A201/A597/I210 Friends,

The first quiz about loops is in OnCourse. I will upload the others
overnight. Lecture and lab notes have been posted in advance up to and
including the first week after Spring Break. Homework Four has been posted
and its due date is March 25. The due date for Homework Three is March 10,
a few days later than the original date announced. A program was posted
that summarizes the lecture of yesterday under What's New? for today.

Tonight I plan to post: explicit page numbers from Wu and summaries of
the chapters you should be reading from Wu (we're in chapter 6 for loops
and chapter 9 for Strings and chars); slides that explain some of the
exercises in Midterm One; and the rest of the examples that should help
you get started (and perhaps finish) Homework Three.

Tomorrow bring your remote pads with you so we can continue taking quizzes
in class. I will also play Mr. Bean episodes before the lecture while I set
up the eInstruction materials (the blue receivers for your pads).

If you have any questions or need any help please let me know.

... Adrian
Thanks to Seun Animashaun and Mindi Wisker for help with the development of this program:
import java.util.*; 

class Processing {
  public static void main(String[] args) {
    ConsoleReader c = new ConsoleReader(; 
    String line; 
    do {
       System.out.print("Echo> "); 
       line = c.readLine();  
    } while (! line.equals("bye")); 
  static String sdrawkcab_gnihtyreve(String line) {
    String result = ""; 
    for (int i = line.length() - 1; i >= 0; i--) {
      result = result + line.charAt(i);    
    return result; 

  static String words_of_order_the_reverse_just(String line) {
    String result = ""; 
    StringTokenizer stapler = new StringTokenizer(line); 
    while (stapler.hasMoreTokens()) {
      String token = stapler.nextToken(); 
      result = token + " " + result; 
    return result; 

  static String tsuj_esrever_eht_stnetnoc_fo_sdrow(String line) {
    String result = ""; 
    StringTokenizer stapler = new StringTokenizer(line); 
    while (stapler.hasMoreTokens()) {
      String token = stapler.nextToken(); 
      String changedToken = ""; 
      for (int i = 0; i < token.length(); i++) {
        changedToken = token.charAt(i) + changedToken; 
      result = result + changedToken + " "; 
    return result; 

  static String no_change(String line) {
    return line; 

This program summarizes perfectly our lecture of yesterday.

Sat-Tue Feb 21-24
Lecture notes for this week, next, posted.

This week (in lecture) we're solving problems, lots of problems.

Wed-Fri Feb 18-20
Homework Two, Report for Lab Five being collected.

Homework Three is in preparation.

Dave Gaunt joins us as a Volunteer Peer Instructor (AI).

Dave will help Steph and Sriam in Thu 6:50pm section in Ballantine.

Thanks and welcome Dave!

Tue Feb 17
The dropbox for Homework Two will close Wed (tomorrow) at the end of the day (11:59pm).

The dropbox for Lab Assignment Five will close Fri (2/20) at the end of the day (11:59pm).

Date: Tue, 17 Feb 2004 11:03:18 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: A201/A597/I210 Update

Today in class we will go over the second part of Homework Two. I
will discuss the last three exercises: Clock, Player, and Elevator.
I will also discuss the questions in Lab Notes Five so you can put
together a brief report for it. Homework Two drop boxes have been
created they will stay open throughout the day tomorrow as well.

We have started loops. We discussed the while loop. Lab Notes Six
discuss a variation of the while loop (called the for loop) and we
will also go over that today and on Thu.

Don't forget to set an individual appointment so we can briefly
discuss your exam and/or what kind of help you might need. The URL
is here and it's listing the available times this week and the next

Thanks and all the best. Please let me know if you need help.

... Adrian

Fri-Mon Feb 13-16
Here's a list of tutors from last year:
1. Scott McCarthy (
2. Anastasiya Chagrova (
3. Reuben Wilson (
4. Steven Bogaerts (
5. Andrew Strain (
I am not sure that the tutors are still available but you can contact them and ask.

Please make individual appointments to discuss your Midterm grades.

Exam grades to be posted today (in Oncourse).

There were 8 students scoring above 90% (but 26 scoring above 87%).

Here are the eight that scored above 90% this time around:

Jin Hwa

Let's call them The Deviants, if you will---in admiration for their performance on the exam.

Congratulations are in order for each one of them (as well as the other 18 that scored above 87%).

Lab Assignment Four has been posted is due on Monday.

Thu Feb 12
BlueJ tutorial and reference manual.

BlueJ home (papers and documentation).

Wed Feb 11

Midterm Exam available in Oncourse (for your reference) as of 9:30pm Wed 2/11.

Midterm One Exam today between 7-9pm in Morrisson 007.

Here's a model Homework One by Brian Bullington who becomes our second student of the week.

Run Brian's program and meet Jo, Lynn and Caitlin.

Splendid work (more comments would be good too)!

Congratulations to Brian Bullington!

Tue Feb 10
Midterm Review today between 7:15-8:15pm in Morrisson 007.

Here's a model Homework One by Jenny Rowland who becomes our first student of the week.

Run Jenny's program and meet

"Tama-chan who likes to sit in [the] trees."

Splendid work!

Congratulations to Jenny Rowland!

Mon Feb 9
Here's the lab assignment again, in review, for added clarification:

10. A year with 366 days is called a leap year. A year is a leap year if it is divisible by 4 (for example, the year 1980), except it is not a leap year if it is divisible by 100 (for example, the year 1900); however, it is a leap year if it is divisible by 400 (for example, the year 2000). There were no exceptions before the introduction of the Gregorian calendar on October 15, 1582 (for example, the year 1500 was a leap year). Write a program (called Ten) that asks the user for a year and computes whether that year is a leap year or not.
Here's a sample run of such a program: Ten
Please enter the year then press Enter : 1500
Leap year: 1500 Ten
Please enter the year then press Enter : 1900
1900 not a leap year! Ten
Please enter the year then press Enter : 1996
Leap year: 1996 Ten
Please enter the year then press Enter : 1997
1997 not a leap year! Ten
Please enter the year then press Enter : 2000
Leap year: 2000
Midterm One Mailbag is now open!

(Please send your questions to

Date: Sun, 8 Feb 2004 13:07:09 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Subject: Midterm One Mailbag

Midterm One (Wed 2/11 7-9pm in Morrison 007) is a multiple choice/short
answer open book open notes test for which the best preparation consists
of practicing with the quizzes in OnCourse. (Don't take those quizzes as
a testing experience instead they're supposed to be a learning experience:
make sure you reach 100% and use the book as well as the posted notes to
determine why the right answer is the one it is.)

The test is on Chapters 1-5 from Wu and the first 110 pages in the
"sOAKed" material (or the posted web notes, lecture and labs).

There's a review session at 7:15pm in Morrison on Tue 2/10. I am also
available by e-mail ( I have opened up a Midterm
One Mailbag. On the What's New? page there's a link (under Sun Feb 8)
that takes you to

The first question (with the posted answer) was from Danny Vu. I look
forward to more questions and/or messages whose answers I can summarize
in the page above. As more questions come the format of the page will
change, and I can list or not list your name depending on your preference.

So, please send me your questions, as you prepare for the midterm.

Thanks for your hard work and hope your weekend is coming along fine.

... Adrian

Sun Feb 8
Midterm One Mailbag inaugurated, please send me ( your questions.

Two exercises from Thu's lecture.

Assume int x = 9; then:

  1. if (x < 6) if (x > 3) print "lost"; else print "dumb"; print "found";

  2. if (x < 6){if (x > 3) print "lost";}else print "dumb"; print "found";

You get

  1. "found" by the first,

  2. but "dumbfound" by the second.

(This is based on an example by Leo Cook and Joy Surya.) -ld
-rw-------   1 dgerman  faculty       316 Feb  6 15:29
class One {
    public static void main(String[] args) {

	int x = 9; 

        if (x < 6) if (x > 3) System.out.print("lost"); else System.out.print("dumb"); System.out.println("found"); 

        if (x < 6){if (x > 3) System.out.print("lost");}else System.out.print("dumb"); System.out.println("found"); 

} One

Sat Feb 7
And here's the Quotation for Friday, February 6, 2004, brought into this weekend:
What the caterpillar calls the end of the world, 
the master calls a butterfly.

Richard Bach 
(1936-, American Author)

Fri Feb 6
Reminder that our office hours are listed here.

Adrian's office hours, for example, are listed as MTWRF 2-3:30pm in LH201D.

Wed-Thu Feb 4-5
Date: Thu, 5 Feb 2004 11:47:29 -0500 (EST)
From: Adrian German <>
To: A201 Spr. 2004 Distr. List <>
Cc: Adrian German 
Subject: A201 update for the week 

Dear A201/A597/I210 Friends, 

Quizzes have been posted in OnCourse to help you prepare for the exam
next week. Please work them out. Today's lecture will try to help with
Homework Two. In labs this week you will receive a new problem, to be
turned in on or before Monday, that counts as Lab Three. You should (and
you definitely can) finish it in lab today/tomorrow to just get it out
of your way right away.

After your midterm we will start getting together one on one (you and
I) in individual appointments so we can discuss your midterm exams. If
you don't do well on it there will be a make-up. This is an open book
and open notes test and you should do your best. Exercises could be
multiple-choice or short answer EXACTLY the type you now see in OnCourse.

Please let me know if you need help or have questions. I will have more
details on the upcoming individual appointments soon.

... Adrian

Tue Feb 3
Here's the first midterm from last Spring (2003).

Here's a midterm from Summer 2001. I will have more examples soon.

Date: Tue, 3 Feb 2004 11:28:35 -0500 (EST)
From: Adrian German <>
To: A201 Spring 2004 Distr. List <>
Subject: A201 Update (Midterm One, Homework Two, Labs Three/Four) 

There will be an exam in Morrison 007 next Wednesday (Feb 11) 7-9pm.

Tuesday before the exam (Feb 10 a week from today) we will have a
review in Morrison 007 from 7:15-8:15pm in preparation for the exam.

The exam is multiple-choice and practice quizzes will be posted soon.
The exam is open book and open-notes but individual work. Chapters 2-5
in Wu and the web notes posted thus far (including assignments) should
be reviewed.

Homework Two has been posted. Two new problems have been added at the
end of Lab Notes Three and the solutions are available from the What's
New? page. They should help you practice boolean expressions in a very
practical context.

If you have questions and/or need help please let me know. Our goal is
that all students be up to date with Lab Assignments One, Two, Three and
Homework Assignment One---while actively working on Homework Two and Lab
Assignment Four---at the time of the first midterm exam.

... Adrian
Here are the solutions to the two extra problems added to Lab Three.

Sat-Mon Jan 31-Feb 2
Interesting point: a Hashtable greatly simplifies Problem 6 (Lab Notes Two).

But we should look into it only after we discuss inheritance.

Fri Jan 30
Here's an older set of notes that illustrate the kind of modelling we're interested in.

Thu Jan 29
Lab Assignment Two tomorrow could be like:

All references above are from Wu.

Wed Jan 28
Homework Assignment One has been posted on the Class Notes page.

Remember that to unpack the Java archive for Homework Two you do this:

jar xvf galapagos.jar
This way using the galapagos classes is similar to using the Lab One classes.

So you should be in great shape to start working on Homework One.

Also, here's the message that was sent to the class list today:

Date: Wed, 28 Jan 2004 12:08:08 -0500 (EST)
From: Adrian German <>
To: A201 Spring 2004 Distr. List <>
Subject: A201/A597/I210 Update

Dear A201/I210/A597 friends,

I hope you're doing well. I just called eInstruction
and here's what they said: all enrollment codes are OK,
but the printer that printed the codes is capable of very
ambiguous printing. So what you think it's an O (oh) is
probably a 0 (zero), and what you think it's a Z (zee)
it actually is a 2 (two) and the other way around.

So their advice is this: if your square tips card says
"Purchase your enrollment code on-line" you must have a
big yellow pamphlet with a red stop sign with the code.
Don't throw that away! It might be hard to read, but it
will have the enrollment code. And if you have trouble
you can safely call eInstruction at 1-888-333-7532 and
they will help you on the phone with your serial number
(off the response pad) and/or the enrollment code.

I will run a few questions every lecture. I will try to
not waste as much time as we did last time ever. I will be
playing a short Mr. Bean clip at the very beginning (2 mins)
so don't be late, or you might miss it. Tomorrow we will be
wrapping up Chapters 2 and 3 from Wu and start on Chapter 4.
You know more than you think you do at this time. I plan to
post Homework One tonight, and come to the rest of the labs
on Friday to meet you all.

I will create one more set of drop boxes, by section for
Lab One. The very late Lab Ones could be collected there and
this will be the last chance to turn in a Lab One. From now on
we're really getting into the rhythm of the semester: the first
midterm exam is on Feb 11 in Morrison 007 (a map will be posted
on the web site as we get closer to the event).

Hope you're having a good time so far and we'll see you tomorrow
in class. If you have any problems or concerns please let me know.

... Adrian

Tue Jan 27
Lecture and lab notes posted up to the first midterm exam.

The first midterm exam is in Morrison 007, on Feb 11, between 7-9pm.

Mon Jan 26
Lecture notes posted in advance.

Lab notes, homework and reading assignments to follow soon.

Sun Jan 25
Just want to make sure I remember to show some Java 3D on Tue in class.

You should be able to play with it in labs.

Fri-Sat Jan 23-24
Here are the solutions to the practice problems listed in Lab Two.

Also, to my regret I was unable to come through all the labs.

I only managed to go to: 1316, 1317, 1318 and 1323. I've been to 1322 last week.

Hopefully I will visit the others next week.

Thanks to David Zai for this set of notes on setting environment variables.

The notes are from the ongoing discussion in the A201 Web Board.

Thu Jan 22
Practice problems for Lab Assignment Two posted (in Lab Notes Two).

Steps to register your response pad with the CPS Online system:

  1. Go to

  2. Click on the STUDENT link.

  3. Choose INDIANA UNIVERSITY from the drop-down menu.

  4. To enroll you need to provide three pieces of information:
    A. The Class Key (R3013V246)

    B. The enrollment code that came with the response pad and

    C. The serial number printed on the back of each response pad.

  5. Click on the JOIN THE CLASS button.

  6. Follow the wizard after that.

Note that you only need to enroll once.
After enrollment using the password and the username would be enough.

Wed Jan 21
Date: Wed, 21 Jan 2004 22:02:15 -0500 (EST)
From: Adrian German <>
To: A201 Spring 2004 Distr. List <>
Subject: A201 Update 

Dear A201/A597/I210 Friends,

Tomorrow in class we will be discussing your first two assignments (when
and where and what you need to turn in). We will also make a demo of the
in-class interactive response system, so you should try to register your
pad on-line. We will discuss how that is done, too. Instructions will be
posted on the class web site at

The class creation key is R3013V246 and has been posted on the What's New?
page and as of the time stamp of this message about 7 students registered
already (congratulations to all seven are in order).

Tomorrow (Thu) and on Fri we go to labs. You should have worked out the
problems in Lab Notes One including those listed under Lab Assignment One
(the staircase and the Penguin problem). In lab tomorrow and on Fri you
will be given a random problem that resembles these two (or any of the
problems listed in Lab One) and you will have until Monday (including) to
turn your solution in OnCourse. That, plus your presence in class when the
problem will be assigned will give you a grade for Lab Assignment One.

Labs tomorrow and on Thu will further try to clarify these issues.

... Adrian
The class key in CPS Online is: R3013V246. You need it to register, this week.

Your Homework One will likely be Problem 27 on page 83 (Wu text).

Here's a short tutorial on using the MS-DOS shell and your CFS by Jeremy.

Tue Jan 20
Complete calendar of reading and homework assignments posted.

Sun-Mon Jan 18-19
On the amount of work expected for A201:

"In A201, we expect you to work hard on a regular basis. Programming is not a spectator sport. It is a skill that requires a great deal of practice in order to achieve a reasonable level of proficiency. Students are expected to spend about eight hours per week outside of class reading and doing the programming assignment."
Of course, we will try to simplify this task for you but you should still be prepared to work hard.

Sat Jan 17
Reading Assignment One: from Thomas Wu's book please read

Try to make sense of them. What do you find useful (or operational) in them?

Fri Jan 16
Key steps to the successful approach of A201:

Work hard. And each time you accomplish something you're proud of

This way information will travel faster than you expect.

It's also going to be of a much higher quality, since we're all working on it.

Thu Jan 15
Lab Notes One should be up to date now.

Here's the main focus from Lab One (link is from the online Java tutorial at Sun).

Lecture Notes One, Two, Three and Four also updated.

A red shooting star next to an active class notes link indicates an up to date document.

Complete list of reading assignments will be posted tomorrow evening.

Wed Jan 14
To install Java on your computer please follow the directions in Sun's Java tutorial.

Message sent to the distribution list, created today:

Date: Wed, 14 Jan 2004 22:56:14 -0500 (EST)
From: Adrian German <>
To: A201 Spring 2004 Distr. List <>
Subject: Welcome to A201/A597/I210!

Dear A201/A597/I210 Students,

The website for this class is at

and tomorrow (Thu Jan 15) we have the first lab. There's nothing that
you need to prepare. You will be guided through the steps necessary to
use the computer, edit, save and open a file containing a Java program,
as well as to compile and run it. The Penguin assignment will also be
explained. There won't be any assignment due for about 10 days, so you
have time to carefully tune into the class by then. Relax, enjoy, and
above all: participate. We're interested in your needs and thoughts,

There is at least one student that doesn't have a network ID and (s)he
will be reading this over the web, maybe. You need such an ID to use the
STC clusters. Please let us know if you have any questions and/or if you
run into any problems. Please check the What's New frequently.

The web site is still to be updated, a bit. Tomorrow and on Friday.

We'll see you in lecture tomorrow and then again in labs, on Thu night,
and on Friday. Its our pleasure to welcome you to A201 and we hope that
you will enjoy the class. If you have questions please let us know.

... Adrian
Here's the Powerpoint from the first lecture.

Tue Jan 13
Class starts, first lecture in Rawles 100 at 4pm.

Class notes page has been updated significantly today.

Mon Jan 12
Spring 2004 semester starts.

Updated by Adrian German for A201/A597 and I210