Project 3 - Addendum

CIS 211 - Computer Science II - Winter, 2003 - A. Hornof

 

Modifications and advice for Project 3 are listed here in reverse chronological order, with new additions at the top.

 

2/4/03 - Ship class

The specification states that the Ship class is a direct subclass of Ship. This is incorrect. It is a direct subclass of SimObject.

2/2/03 - Question: I create a number of .java files such as Location.java and Island.java and they all compile fine. But then I add them to the maritime package in a "maritime" subdirectory and try to compile them again, and they can't find each other. What's going on? What should I do?

Answer: Let's say your CLASSPATH is set to "." which means that "javac.exe" will look for packages in subdirectories (with the same name as the package) off of the directory where you are compiling, regardless of whether you run it from within TextPad or from the command line.

If the maritime directory is your current working directory when you compile SimObject.java then the maritime directory will no longer be in your classpath. In other words, if your current directory is

  C:\My Documents\CIS 211\Project 3\maritime>

and you run

  javac SimObject.java

then the current directory is

  C:\My Documents\CIS 211\Project 3\maritime\

and so javac is looking for the other files, like Location.class, in

  C:\My Documents\CIS 211\Project 3\maritime\maritime\

Here is one solution: First, just to be safe, delete any .class files in any of these directories that might be hanging around from previous compilations of your code. Then, create a P3.java file in the

  C:\My Documents\CIS 211\Project 3\

directory. Have this P3.java file use one or more of the classes in maritime. The compiler will look for them in

  C:\My Documents\CIS 211\Project 3\maritime\

It will find the .java files but no .class files, and so it will compile the .java files to create the .class files, leave the .class files in the same subdirectory, and Java will use those files when compiling and running P3.java.

Here is an alternative way to solve this problem. It works on Unix and should probably work on Windows:

While in the

  C:\My Documents\CIS 211\Project 3\

directory, execute the following:

  javac maritime\SimObject.java

In this case, Project 3 is the working directory, so javac would look for the package in the maritime subdirectory off of that directory (and find it). This solution would also explicitly point javac to the .java files in the maritime subdirectory so the .java file could compile it. 

2/2/03 - CruiseShip class has two methods: CruiseShip() and toString()

The specification incorrectly says that the CruiseShip class should have two methods: Ship() and toString(). The two methods should actually be CruiseShip() and toString(). Following the same pattern, the Tanker class should have Tanker() and toString(), and the PirateShip class should have PirateShip() and toString().

2/2/03 - Don't read from "world.txt"

For Project 3, your program should not be reading from "world.txt". The P3.java that you turn in should just call constructors with "hard-coded" arguments (written directly into the source code) that you make up.

1/29/03 - Java 1.4.0 Only

The grading staff has already encountered a discrepancy between Java 1.3.1 and Java 1.4.0 (in terms of how the two versions handle the import statement--version 1.4.0 seems to be more strict in finding problems). Project 3 and all future programming assignments must be written in Java 1.4.0. Mac users (such as myself) can still do our development in 1.3.1. You just need to move your code to a Unix or Windows machine running 1.4.0, compile, test, and debug again before submitting to e-turnin. Be sure to budget some time to find bugs that crop up after moving it to 1.4.0.

If you are using an older version (type "java -version" to see what you are using), you should download and use 1.4.0.

 

1/29/03 - Correction to MaritimeModel() constructor

private MaritimeModel ()
should output
MaritimeModel constructed

and not

MaritimeModel <name> constructed

as was specified in an earlier correction
and not

SimObject <name> constructed

as is listed in the specification.

describeSimObjects ()
SHOULD however output
SimObjects in the MaritimeModel:

as well as the list of SimObjects, as is specified.

 

1/28/03 - Check your files after e-turning in your projects. Submit early.

Due to the large number of files that are being turned in, it is important that you verify that you submitted the correct files into the correct fields in e-turnin after you complete your e-turnin session. When we tested e-turnin for submitting a solution to Project 3, a user error evidently resulted in the wrong file being put into the wrong field. It is important that you verify that you put the correct files--with the correct classname spelling--into the correct fields in e-turnin.

This Project is due on Monday, February 3, at 5 PM, but do not wait until the last hour to submit your solution. All e-turnin submissions must be completed, verified, and corrected as necessary by 5 PM on the due date, and the system may slow down as the deadline approaches. To be safe, think of the deadline as 4 PM.