Lists

CS 160 In-Lab 9
November 7, 2001

You may work with up to one partner on this assignment. You and your partner must both be in the same lab section. If you work with a partner, hand in one assignment with both of your names on it.

Sorted Lists

The purpose of this in lab is to help you better understand lists in Java. Remember that as you work with code that deals with lists, it is very, very helpful to draw pictures.

Copy the lecture code from November 5th into a BlueJ project called inlab9. Notice that the Driver.java file has been modified so that all of the Computer Science faculty show up as students in the CS 160 class. Modify the addStudent method (but don't make any changes anywhere else) so that the method keeps the list of students in alphabetical order by last name. Before you start coding, you should spend some time designing your solution with pencil and paper.

When your program is working correctly, printout a copy of the output that it produces as well as a copy of the modified Course.java file. Have either that lab TA or a lab consultant come to your terminal and run your program. He or she will write either OK or WRONG and sign his or her initials. He or she will also look at your Driver.java file and your Course.java file to make sure that you don't change anything except for the addStudent method.


If you finish early ...

Spend any extra time that you have working on the programming assignment that is due in lab next Tuesday.

What to Submit

  1. A printout of your modified Course.java file.
  2. The checked printout of the output that your program produces when it is run.