Project 4 - Addendum

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

 

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

2/17/03 - Constructor outputs may preceed formatting errors.

It is fine if your program starts building the MaritimeModel object and then quits because it encountered an input file formatting error. Most people will probably implement it this way. The output in this case might look something like:

> java P4 
MaritimeModel constructed
SimObject Sloop_John_B constructed
Ship Sloop_John_B constructed
PirateShip Sloop_John_B constructed
Error: Line 4 in maritime simulation data
file is improperly formatted:
"Ship ScullyWagger Pirate 50 101"
> _

It is also fine if your program checks every line before building the MaritimeModel object, in which case none of the constructor messages above would have been printed out before the error message.

2/17/03 - Resubmit Project 4. Deadline extended.

If you submitted your Project 4 before noon today (Monday), you need to go back and resubmit. But you should only need to add new files. What you already submitted should still be there. We initially planned on running your projects by just using our own SimObject, Island, Ship, CruiseShip, Tanker, PirateShip, and Location classes. But we have now decided that it would be better to collect and test these files that you have created.

To accommodate this short notice, the deadline for Project 4 has been extended by 24 hours. It is now due tomorrow (Tuesday) at 5 PM.

2/16/03 - Sample input file and execution trace

Here is a possible input file (world.txt in this case):

Maritime Simulation World State
World_size 100 100
Ship Sloop_John_B Pirate 1 99
Ship ScullyWagger Pirate 50 99
Island Lost 50 10 5 10

Here is one possible command line execution trace. Slightly different versions will be acceptable depending on, for example, when your MaritimeModel gets constructed.

> java P4 
MaritimeModel constructed
SimObject Sloop_John_B constructed
Ship Sloop_John_B constructed
PirateShip Sloop_John_B constructed
SimObject ScullyWagger constructed
Ship ScullyWagger constructed
PirateShip ScullyWagger constructed
SimObject Lost constructed
Island Lost constructed
Overwrite existing data file "world.txt"? (Y/N) y
> _

2/16/03 - Island should have four integers.

The getFileLine() for the Island class should return the following (assuming these data values):

Island Hawaii 87 2 10 3

The 10 is the amount of fuel oil currently available at the island. The 3 is the production rate of oil on that island.

getFileLine() method in SimObject.

You may find it useful to create an abstract getFileLine() method in SimObject.

QuittingException needs a public constructor.

The QuittingException class may need a public constructor if it is to be called from stringListToModel() in MaritimeModel.java.

2/11/03 - Add a getX() and a getY() to Location.

In the Location class, you may add public getX() and getY() methods that return ints. Be careful that you spell them exactly as such since you are not actually submitting this code, but will be using our code in which we've added these methods.

2/9/03 - Error message for improperly formatted line in the data file.

Strike (remove) the <data filename> from the error message. The new error message for any improperly formatted line in the data file is now:

Error: Line <line number> in maritime simulation data 
file is improperly formatted: "<The line appears here>"

2/7/03 - Question: Where does main() go?

Answer: P4_1.java should have a main(), as should P4.java.