Essay CMSC 335 Project 1 SeaPort
CMSC 335 Project 1 SeaPort
Introduction – the SeaPort Project series
For this set of project, we wish to simulate some of the aspects of a number of Sea Ports.
Here are the classes and their instance variables we wish to define:
- SeaPortProgram extends JFrame
- variables used by the GUI interface
- world: World
- Thing implement Comparable <Thing>
- index: int
- name: String
- parent: int
- World extends Thing
- ports: ArrayList <SeaPort>
- time: PortTime
- SeaPort extends Thing
- docks: ArrayList <Dock>
- que: ArrayList <Ship> // the list of ships waiting to
dock - ships: ArrayList <Ship> // a list of all the ships at
this port - persons: ArrayList <Person> // people with skills at
this port
- Dock extends Thing
- ship: Ship
- Ship extends Thing
- arrivalTime, dockTime: PortTime
- draft, length, weight, width: double
- jobs: ArrayList <Job>
- PassengerShip extends Ship
- numberOfOccupiedRooms: int
- numberOfPassengers: int
- numberOfRooms: int
- CargoShip extends Ship
- cargoValue: double
- cargoVolume: double
- cargoWeight: double
- Person extends Thing
- skill: String
- Job extends Thing – optional till Projects 3 and 4
- duration: double
- requirements: ArrayList <String>
// should be some of the skills of the persons
- PortTime
- time: int
Eventually, in Projects 3 and 4, you will be asked to show the progress of the jobs using JProgressBar’s.
Here’s a very quick overview of the projects:
- Read a data file, create the internal data structure, create a GUI to display the structure, and let the user search the structure.
- Sort the structure, use hash maps to create the structure more efficiently.
- Create a thread for each job, cannot run until ship has a dock, create a GUI to show the progress of each job.
- Simulate competing for resources (persons with particular skills) for each job.
General Objectives
Here are some notes about the projects, the particular features of object-oriented design and object-oriented programming (OOD/OOP) the we want to cover in this class and some of the features of Java to help support that style of programming. We also want to explore the Java GUI system a little, with particular emphasis on viewing the data structures and effective ways to display the running of multiple threads competing for resources.
The particular scenarios selected for each semester ask you to implement as many of these objectives as possible in some compelling way. We are always open to additions and suggestions.
General objects for each project:
- Project 1 – classes, text data file, GUI, searching
- Define and implement appropriate classes, including:
- instance and class variables,
- constructors,
- toString methods, and
- other appropriate methods.
- Read data from a text file:
- specified at run time,
- JFileChooser
jfc = new JFileChooser (“.”);
// start at dot, the current directory
- JFileChooser
- using that data to create instances of the classes,
- creating a multi-tree (class instances related in
hierarchical, has-some, relationships), and - organizing those instances in existing JDK structures
which can be sorted, such as ArrayList’s.
- specified at run time,
- Create a simple GUI:
- presenting the data in the structures with with some
buttons and - text fields supporting SEARCHING on the various fields of
each class.
- presenting the data in the structures with with some
- Define and implement appropriate classes, including: