CS 051 -- Laboratory #2
Dirty Laundry

Objective: To gain experience using conditionals.

The Scenario. One thing many students have to figure out for the first time when they come to college is how to wash their clothes. Often by the time most students have figured it out, all their underwear is pink and T-shirts and other light-colored items are streaked with all sorts of interesting colors. In the hopes of helping next year's first-year students adjust more easily to college, we would like you to write a laundry sorting simulator.

The Approach. It is usually a good practice to develop programs incrementally. Start with a simplified version of the full problem. Plan, implement and test a program for this simplified version. Then, add more functionality until you have solved the full problem.

To encourage this approach, we have divided this lab into two parts. For the first, we will describe a laundry sorter with a very simple interface. You should plan, implement and test a program for this problem first. Then, in the second part of the assignment we will ask you to add additional functionality.

You are also encouraged to approach each of our two parts in this step-wise fashion. For example, in the first part you might begin by just writing the instructions to construct the necessary graphical objects without worrying about any of the mouse event handling. Once your program can draw the picture, you can move on to figure out how to handle events.

The Design. You should bring a design for the first part of this assignment to lab. The design should include the name of the main class, the names of constants and instance variables, and the names of the methods. In addition, everything should be commented: what will each instance variable keep track of and what will each method do? Finally, the design should give a sense of how each method will do what it's supposed to do (put in comments!).

The design is an important step in the coding process! You should approach it as attempting to answer the above questions, not as trying to see how far along you can get in coding the lab. I promise you thinking about the design at a higher-level will make your life easier in the long run.