ANNOUNCEMENTS

The following are in reverse chronological order.

Tue May 15 16:57:35 EDT 2007
Lab Exam grades along with comments are now available in file labExamComments.txt.
Tue May 1 18:34:05 EDT 2007
USB drives can be picked up at the office of the Computer Science secretary (third floor Robinson northeast corner).
Mon Apr 30 11:16:51 EDT 2007
Extra credit possibility: Exercises 7.1 through 7.49 inclusive. Some number of points, based on originality, quality, and difficulty, will be added to your lab midterm or lab exam grade or your quiz total, whichever helps you the most. Due on a labeled USB drive no later than the written quiz redo (final exam), Tuesday, May 1, 2007, 2:45 pm.
Plagiarism and academic honesty guidelines: Each student does his/her own project although you may ask other students and/or me about clarifying the project or for ideas about how to approach doing something in the project. You will do all the computer work yourself (including typing and mousing) and not allow another student to copy your work and not yourself turn in work copied from someone else. You will not ``dictate'' mousing and typing to another student nor be ``dictated'' to yourself.
Thu Apr 19 14:27:16 EDT 2007
Quiz 12 (the last quiz of the semester, hooray, you and me both!) will be at the beginning of class Thursday, April 26, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--04 of the BlueJ book and electronic handouts, through Monday, April 23, 2007. From now on, all our Java knowledge and experience will be cumulative, so you cannot wipe from your mind the terms and concepts learned for previous quizzes because those previous terms and concepts will still be used in subsequent quizzes. In other words, the current quiz will focus on the terms and concepts listed below, but will also necessarily include all previous terms and concepts as background.
Mon Apr 16 15:12:45 EDT 2007
You should do the following before trying to use your USB drive with Knoppix again.
  1. Boot windows XP.
  2. Plug your USB drive into a USB port.
  3. Open up My Computer.
  4. Right-click the icon for your USB drive and select Properties at the bottom.
  5. Click the Tools tab.
  6. Run the disk check program (first button, I think, and is right above the disk defragment button, I think).
  7. Safely remove your USB drive.
  8. Boot Knoppix before plugging in your USB drive.
  9. When Knoppix has booted completely, plug your USB drive in.
  10. Click the Cancel button in the dialog box that appears.
  11. Open up a root shell window by clicking the penguin just to the right of the big K and selecting Root Shell.
  12. In the root shell, type the following commands. On the Robinson 325 machines, use sdb1 as shown. On other machines, you might need to use sda1.
    mount -t vfat /dev/sdb1 /media/sdb1
    mount -o remount,rw /dev/sdb1
    losetup /dev/loop4 /media/sdb1/knoppix.img
    fsck /dev/loop4
    losetup -d /dev/loop4
    umount /dev/sdb1
    exit
    
  13. Leave your USB drive plugged in and reboot Knoppix.
  14. Hit TAB and ENTER at the gray dialog box.
  15. You know the rest....
Thu Apr 12 16:35:41 EDT 2007
Quiz 11 will be at the beginning of class Thursday, April 19, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--04 of the BlueJ book and electronic handouts, through Monday, April 16, 2007. From now on, all our Java knowledge and experience will be cumulative, so you cannot wipe from your mind the terms and concepts learned for previous quizzes because those previous terms and concepts will still be used in subsequent quizzes. In other words, the current quiz will focus on the terms and concepts listed below, but will also necessarily include all previous terms and concepts as background.
Mon Apr 9 17:43:00 EDT 2007
Quiz 10 will be at the beginning of class Thursday, April 12, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--04 of the BlueJ book and electronic handouts, through Monday, April 9, 2007. From now on, all our Java knowledge and experience will be cumulative, so you cannot wipe from your mind the terms and concepts learned for previous quizzes because those previous terms and concepts will still be used in subsequent quizzes. In other words, the current quiz will focus on the terms and concepts listed below, but will also necessarily include all previous terms and concepts as background.
Tue Apr 3 14:49:17 EDT 2007
We have added the following code to the Club class.
public int joinedInMonth(int month) {
   if (month < 1 || month > 12) {
      System.out.println(month + " is out of range");
      return 0;
   }
   int howMany = 0;
   for (Membership member : roster) {
      if (member.getMonth() == month) {
         howMany++;
      }
   }
   return howMany;
}

public ArrayList<Membership> purge(int month) {
   ArrayList<Membership> purged = new ArrayList<Membership>();
   int positionNumber = 0;
   while (positionNumber < roster.size()) {
      Membership member = roster.get(positionNumber);
      if (member.getMonth() == month) {
         purged.add(member);
         roster.remove(positionNumber);
      } else {
        positionNumber++;
      }
   }
   return purged;
}
  
Tue Apr 3 14:11:07 EDT 2007
Let's go by Banner and have the quiz ``Redo'' (written final exam) on Tuesday, May 1, 2007, 2:45--4:45pm, Robinson 325. I changed the online syllabus.
Mon Apr 2 15:31:55 EDT 2007
We have added the following code to the Auction class.
public Lot getLot(int lotNumber) {
   if((lotNumber >= 1) && (lotNumber < nextLotNumber)) {
      for (Lot lot : lots) {
         if (lot.getNumber() == lotNumber) {
            return lot;
         }
      }
      System.out.println("No lot found with lot number matching " + lotNumber);
      return null;
   } else {
      System.out.println("Lot number: " + lotNumber + " does not exist.");
      return null;
   }
}

public void close() {
   for (Lot lot : lots) {
      if (lot.getHighestBid() == null) {
         System.out.println("The lot of " + lot.getDescription() + " is unsold"
            + " (serial number " + lot.getNumber() + ").");
      } else {
         System.out.println("The lot of " + lot.getDescription() + " sold for "
            + lot.getHighestBid().getValue() + " to "
            + lot.getHighestBid().getBidder().getName());
      }
   }
}

public ArrayList<Lot> getUnsold() {
   ArrayList<Lot> unsold = new ArrayList<Lot>();
   for (Lot lot : lots) {
      if (lot.getHighestBid() == null) {
         unsold.add(lot);
      }
   }
   return unsold;
}

public Lot removeLot(int lotNumber) {
   int positionNumber = 0;
   while (positionNumber < lots.size()) {
      Lot lot = lots.get(positionNumber);
      if (lot.getNumber() == lotNumber) {
         lots.remove(positionNumber);
         return lot;
      }
      positionNumber++;
   }
   System.out.println("No lot found with lot number matching " + lotNumber);
   return null;
}
  
Mon Apr 2 15:30:18 EDT 2007
Quiz 09 will be at the beginning of class Thursday, April 5, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--04 of the BlueJ book and electronic handouts, through Monday, April 2, 2007. From now on, all our Java knowledge and experience will be cumulative, so you cannot wipe from your mind the terms and concepts learned for previous quizzes because those previous terms and concepts will still be used in subsequent quizzes. In other words, the current quiz will focus on the terms and concepts listed below, but will also necessarily include all previous terms and concepts as background.
Wed Mar 28 13:40:00 EDT 2007
One of the best Java books is available online for free from Sun at java.sun.com/docs/books/tutorial. The API we were looking at in class is at java.sun.com/j2se/1.5.0/docs/api.
Fri Mar 23 12:12:28 EDT 2007
Lab Midterm grades along with comments are now available in file labMidtermComments.txt.
Thu Mar 22 14:23:08 EDT 2007
Quiz 08 will be at the beginning of class Thursday, March 29, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--04 of the BlueJ book and electronic handouts, through Monday, March 26, 2007. From now on, all our Java knowledge and experience will be cumulative, so you cannot wipe from your mind the terms and concepts learned for previous quizzes because those previous terms and concepts will still be used in subsequent quizzes. In other words, the current quiz will focus on the terms and concepts listed below, but will also necessarily include all previous terms and concepts as background.
Thu Mar 22 14:21:37 EDT 2007
Two interesting BlueJ discoveries in IOOP class spring 2006:
Thu Mar 22 14:04:19 EDT 2007
The ``Last'' Assignment is due in class Thursday, April 26, 2007.
Wed Mar 21 13:15:10 EDT 2007
Quiz 07 will be at the beginning of class Thursday, March 22, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--03 of the BlueJ book and electronic handouts, through Monday, March 19, 2007. From now on, all our Java knowledge and experience will be cumulative, so you cannot wipe from your mind the terms and concepts learned for previous quizzes because those previous terms and concepts will still be used in subsequent quizzes. In other words, the current quiz will focus on the terms and concepts listed below, but will also necessarily include all previous terms and concepts as background.
Fri Mar 16 14:57:24 EDT 2007
This is a reminder that the lab midterm will be Monday, March 19, 2007. Remember to put an external label with your name on your USB drive.
Fri Mar 2 10:29:25 EST 2007
Quiz 06 will be at the beginning of class Thursday, March 8, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, find a bug in some code, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--03 of the BlueJ book and electronic handouts, through Monday, March 5, 2007.
Wed Feb 28 12:17:08 EST 2007
The lab midterm will be Monday, March 19, 2007. You will be turning in your work on a USB drive and you must use AN EXTERNAL LABEL of some sort to put your name on your USB drive on the outside before coming to class. USB drives without an external label containing your name will result in a 20 point deduction from your lab midterm grade!
Mon Feb 26 16:11:42 EST 2007
One way to do the twelve-hour clock display is as follows. It keeps all of the twenty-four-hour clock display code and adds code for a twelve-hour clock display variable. Not shown are the unchanged constructors and methods and an accessor method for the twelve-hour time.
/**
 * Twelve-hour clock display.  Internal time is a 24 hour clock.
 */
class ClockDisplay {
   private NumberDisplay hours = new NumberDisplay(24);
   private NumberDisplay hours12 = new NumberDisplay(9876); // limit unused
   private NumberDisplay minutes = new NumberDisplay(60);
   private String display12String;  // simulates the actual 12 hour display
   private String displayString;    // simulates the actual 24 hour display

   ...

   private void updateDisplay() {
      String ampm;
      displayString = hours.getDisplayValue() + ":" + minutes.getDisplayValue();
      if (hours.getValue() == 0) hours12.setValue(12);
      else if (hours.getValue() > 12) hours12.setValue(hours.getValue() - 12);
      else hours12.setValue(hours.getValue());
      if (hours.getValue() < 12) ampm = " am";
      else ampm = " pm";
      display12String = hours12.getDisplayValue() + ":" + minutes.getDisplayValue() + ampm;
   }
}
Sat Feb 24 13:21:54 EST 2007
Quiz 05 will be at the beginning of class Thursday, March 1, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--03 of the BlueJ book and electronic handouts, through Monday, February 26, 2007.
Tue Feb 20 15:53:48 EST 2007
Incompletely tested five-card poker hand classes: Card.java, Hand5.java, Poker5.java.
Fri Feb 16 16:43:22 EST 2007
Quiz 04 will be at the beginning of class Thursday, February 22, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--02 of the BlueJ book and electronic handouts, through Monday, February 19, 2007.
Tue Feb 13 07:14:56 EST 2007
I am leaving office hours early (before 3pm) today to beat the weather.
Mon Feb 12 16:57:24 EST 2007
Quiz 03 will be at the beginning of class Thursday, February 15, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--02 of the BlueJ book and electronic handouts, through Monday, February 12, 2007.
Fri Feb 9 10:45:22 EST 2007
The poker hand classes that we got started on yesterday: Card.java, Hand.java.
Mon Feb 5 16:26:13 EST 2007
Quiz 02 will be at the beginning of class Thursday, February 8, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation, write a bit of code (small class definition or new method in an existing class), and execute a program manually mentally by hand and write down what the program prints out line by line as it executes. It will cover the following terms and concepts from lab work, class discussion, and Chapters 01--02 of the BlueJ book and electronic handouts, through Monday, February 5, 2007.
Mon Jan 29 17:37:03 EST 2007
Quiz 01 will be at the beginning of class Thursday, February 1, 2007. It will be about 20 minutes long, written, closed-book, closed-notes. Typical questions are definition, short answer description or explanation. It will cover the following terms and concepts from lab work, class discussion, and Chapter 01 of the BlueJ book and electronic handouts, through Monday, January 29, 2007.
Mon Jan 29 16:01:08 EST 2007
Half the class (12 out of 24 ``pop'' quizzes turned in) indicated no previous programming experience.
Fri Jan 26 10:46:33 EST 2007
Here is the boot information for Knoppix in Robinson 325. When you see boot: in the lower left, type knoppix bootfrom=/dev/sda1/knoppix.iso followed by the ENTER key so that it looks like this.
boot: knoppix bootfrom=/dev/sda1/knoppix.iso
Don't forget the TAB and ENTER keys when the gray dialog box appears.
Wed Jan 24 14:18:52 EST 2007
Here is a better planet class, Planet2.java, that I will discuss in class tomorrow. I will use (and explain) this testing code: SomePlanets.java. For comparison, the one we developed in class is available here: Planet.java. We will also look at some arithmetic ``anomolies'' shown be executing this program: TestingMath.java. Can you predict what the output will be?
/**
 * A better Planet class: encapsulation, information hiding,
 * responsibility-based design.  The original Planet class
 * depended on code somewhere else to calculate new (x, y)
 * coordinates as the planet object moves in orbit around
 * the sun.  This Planet class is responsible for making those
 * calculations itself when it is told to move (an action method).
 * Also the original Planet class was vulnerable to some incorrect
 * code somewhere else setting x or y to an arbitrary value, taking
 * the planet out of its elliptical orbit, clearly a bug (error).
 *
 * @author Computer Science and Programming
 * @version 2007.01.24
 */
class Planet {
  private int size;           // diameter in miles
  private String color;
  private String name;
  private int x;              // coordinate in miles, sun is at (0, 0)
  private int y;
  private int majorAxis;      // elliptical orbit diameter in miles
  private int minorAxis;
  private int lengthOfYear;   // seconds

  public Planet(int s, String c, String n, int ix, int iy, int ma, int mi, int y) {
    size = s;
    color = c;
    name = n;
    x = ix;
    y = iy;
    majorAxis = ma;
    minorAxis = mi;
    lengthOfYear = y;
    // Put code here to make sure that s, ix, iy, ma, mi, and y are not
    // negative.  Also, put code here to make sure that (x, y) lie on
    // the elliptical orbit.  Print error messages (or throw a runtime
    // error) if any of these tests fail.
  }

  public String getName() {
    return name;
  }

  public String getColor() {
    return color;
  }

  public int getX() {
    return x;
  }

  public int getY() {
    return y;
  }

  // Put other `get' (query) methods here.

  /**
   * Move the planet object to where it will be in so many
   * seconds in the future.
   * @param seconds  the number of seconds in the future
   */
  public void move(int seconds) {
    int deltax = 0;
    int deltay = 0;
    // Put code here to calculate the (deltax, deltay) values to move
    // the planet to where it will be `seconds' in the future.
    x = x + deltax;
    y = y + deltay;
  }
}
Wed Jan 17 11:12:21 EST 2007
Beginning Thursday, January 18, 2007, we will meet in Robinson 325 (same room as our lab on Mondays) on Tuesdays and Thursdays. Wilson 105 has no board space when the projector screen is pulled down and the computer there does not let me boot Knoppix and project the what's showing on the computer monitor on the projector screen.
Thu Jan 4 16:35:05 EST 2007
Welcome to Computer Science and Programming!


home page: http://elvis.rowan.edu/~hartley/index.html
e-mail: hartley@elvis.rowan.edu