cp -r ~mc28/labs/java/java .(Note that this command ends with a space and then a period. Ask for help with this if you need it.) You will get a new directory called
java
. This directory contains three subdirectories, one
for each portion of the lab. All the individual java files you will
use are in one of those subdirectories.
You can complete this lab using either of two programming environments; feel free to ask for help with either:
You can use a text editor (such as emacs) to edit the java files and use a terminal window to issue commands for such tasks as compilation.
You can use the BlueJ programming environment, as introduced in a prior lab. If you take this approach, the first time you open one of the three subdirectories, you'll need to do it with the "Open Non BlueJ..." option in the Project menu.
ItemList.java
the class that
holds the Items the customer is ordering
Item.java
the base class for
different kinds of clothing items, specifically
CompuDuds.java
this is the main program class; it has no instances but has a number
of important "static" methods (i.e., methods that are class-wide, not
associated with any specific instance).
The first thing to do is to test the program out without yet having
made any changes. That way you have a baseline for comparison: if it
isn't working, you aren't the one who broke it. To run the program,
compile the source files and run the main method in the
CompuDuds
class. If you are using a terminal window
rather than BlueJ, you would change directory to the CompuDuds
directory and then type
javac *.java java CompuDuds
Now you can start making the necessary changes, and test and debug as you go along. Do exercises 15.2 through 15.4 on pages 598-599 as well as exercise 15.20 on pages 640-641 of the text. For exercise 15.3, you will need to make a new class that is very similar to one of the existing classes. If you are using BlueJ, you can use a menu option to create the new class, then use copy and paste commands to paste the existing class's code into the newly created class, as a starting point. If you are using an editor such as emacs, the simplest option is probably to open the existing file and save it out under the new name. (As usual, I'd be happy to help with the mechanics.)
For exercises 15.2, 15.4, and 15.20, you should just modify the existing classes rather than creating any new class. Furthermore, when submitting this part of the project, just submit the final form of the CompuDuds directory, which contains all the changes for the four exercises together.
java
directory (which
contains the puzzle
directory), the command
cp -r puzzle flipwould make a copy of the
puzzle
directory called flip
.
sleep
commands and the synchronized
keywords
in your code. (The synchronized
should get rid of the
problems exposed by the calls to sleep
.)
Your solution to 15.14 should be precise. Mathematical assertions, such as invariant (1), are best confirmed with clear notation and equations (and only a little text).
For exercise 15.16, be sure to clearly explain where you put your
calls to sleep
to make each behavior happen.
The gradesheet for the project is available in PostScript or PDF format. (If you print a copy out, you can staple it to the front of your project report to save paper.)
CompuDuds
portion, you won't be able to thoroughly
test all your changes just using the main
method that is in the
CompuDuds
class. The best way around this, especially if
you are not using BlueJ, is probably by writing another
main
method in the ItemList
class to do some additional testing.
cd
to the directory containing the
java directory that contains the four portions (subdirecotories) of
the lab, and type ls
to make sure you are in the right
place. Finally, type:
~sskulrat/public/178/submit java