Lab Summary

Lab # Due Date Topic
1 Feb 8
Using objects
2 Feb 15
Conditionals
3 Feb 22
Defining classes
4 Mar 1
More classes
5 Mar 22
Loops
6 Mar 31
Interfaces and Array
7 Apr 7
Array and Recursion
8 May 3 File Handling and Sorting
9 May 7 Project
9 April 28 Exam 2

Lab location and hours

Lab MW 1:15 - 2:30pm
Acopian 515 Ge (Frank) Xia

Lab Instructions

Labs are due on the specified due date, at the beginning of class time (not lab time). Since each lab requires significant time to read and understand, you should regard every lab as part of your weekly reading assignment. To avoid wasting lab time, read the lab assignment thoroughly before coming to the lab session. The assignment may describe work that you must bring with you to the lab.

To hand in your lab

These instructions are for the Linux machines in the laboratory.

  1. Go to Lafayette's Moodle site.
  2. Log in using your Lafayette user Id and password.
  3. Go to CS102L.01_SP10 Lab.
  4. Submit your assignment following the link for each lab in the list.
  5. Only submit the java files or the files specified in the lab description.
  6. The submission must occur before the deadline. The submission is closed after the deadline. Late submission will not be accepted, unless exceptions are given by the instructor.

To publish your handiwork on a web page

If you want to turn your lab solution into a web applet, do the following:
  1. Change the class that extends FrameWindowController to extend WindowController, and recompile.
  2. You want to work in the folder where your files are stored, so open a terminal window and enter cd ~/CS102/labn where n is the lab number.
  3. You're going to make an archive file ("jar file") containing all your class files. You can call it whatever you want. Assuming it's called "demo.jar", you would enter
    jar -cf demo.jar *.class
  4. If there are other files needed by your applet (like .au, .jpg, or .gif files) add them to the jar file too. Example:
    jar uf demo.jar *.au
  5. The jar file is now (if all went well) a self-contained version of your whole program. You can copy it to the folder (directory) containing the web page where you want to show the applet.
  6. In your web page, you need some html tags to include the applet. I'm going to give you the old-fashioned way, but eventually you'll want to learn the W3C-approved tags. If the class that extends WindowController is named, say, Nibbles, your html will look like this:
    <applet archive="demo.jar" code="Nibbles" width="600" height="650"></applet>
    Adjust the size of the applet window by changing the width and height attributes.
  7. Note that there is no reason to put .java files in the jar file.

Some labs materials were adapted from materials developed at the Department of Computer Science , Williams College