Placeholder

CMSC 335 Project 1 SeaPort

$40.00

Description

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
index: int
name: String
parent: int
World extends Thing
ports: ArrayList
time: PortTime
SeaPort extends Thing
docks: ArrayList
que: ArrayList // the list of ships waiting to
dock
ships: ArrayList // a list of all the ships at
this port
persons: ArrayList // people with skills at
this port
Dock extends Thing
ship: Ship
Ship extends Thing
arrivalTime, dockTime: PortTime
draft, length, weight, width: double
jobs: ArrayList
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
// 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
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.
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.
SCREENSHOTS
SOLUTION
PAYMENT
The solution includes a Netbeans project and full java source code.
Attachments [Move over files to preview content of those files]
CMSC_355_Project_1.zip (40.74 KB)
Netbeans Project
SeaPort
aSPaa.txt
build
classes
.netbeans_automatic_build
.netbeans_update_resources
CargoShip.class
Classes
Cargo
Docks
Ships
Dock.class
Job.class
Menus
PassengerShip.class
Person.class
PortTime.class
SeaPort.class
SeaPortsProgram.class
Ship.class
Thing.class
World.class
build.xml
manifest.mf
nbproject
build-impl.xml
genfiles.properties
private
private.properties
project.properties
project.xml
src
CargoShip.java
Dock.java
Job.java
PassengerShip.java
Person.java
PortTime.java
SeaPort.java
SeaPortsProgram.java
Ship.java
Thing.java
World.java
test
readme.txt
Preview aSPaa.txt
// xxxx xxxx xxxxx xxxxxx(xxxx)
// xxxx
xxxx xxxx_4 20004 10000 30004
xxxx xxxx_0 20000 10000 30000
xxxx xxxx_1 20001 10000 30001
dock Pier_3 20003 10000 30003
dock Pier_2 20002 10000 30002

// pship name index parent(dock/port) weight length width draft numPassengers numRooms numOccupied
// pship
pship Gallinules 30000 20000 125.99 234.70 60.67 37.14 746 246 246
pship Remora 30001 20001 126.38 358.27 74.12 31.54 3768 979 979
pship Absentmindedness 30004 20004 86.74 450.43 33.13 41.67 2143 920 920
pship Preanesthetic 30003 20003 149.85 483.92 125.71 31.21 166 409 83
pship Shoetrees 30002 20002 134.41 156.96 120.31 35.20 1673 633 633

// cship name index parent(dock/port) weight length width draft cargoWeight cargoVolume cargoValue
// xxxxx
xxxxx xxxxxxxxx 40001 10000 200.80 242.33 38.31 23.49 172.73 188.54 235.57
xxxxx xxxxxxxxx 40000 10000 120.85 362.55 96.82 19.09 33.08 188.31 261.57
xxxxx xxxxxxxx 40002 10000 79.90 234.26 73.18 15.71 125.27 179.00 729.95
xxxxx xxxxxxxxx 40003 10000 219.92 443.54 104.44 34.16 86.69 139.89 813.72
xxxxx xxxxxxx 40004 10000 189.12 448.99 73.97 37.67 88.90 175.03 1002.63
Preview CargoShip.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxxxxxxx xxxxxxx xxxx {
xxxxxx xxxxxxxxxx;
double cargoVolume; double cargoWeight;
public CargoShip(Scanner sc) { super(sc); if(sc.hasNextDouble()) { cargoWeight = sc.nextDouble();
}
xx(xx.xxxxxxxxxxxxx()) {
xxxxxxxxxxx = xx.xxxxxxxxxx();
}
xx(xx.xxxxxxxxxxxxx()) {
xxxxxxxxxx = xx.xxxxxxxxxx();
Preview Dock.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxx xxxxxxx xxxxx {
xxxx xxxx;
public Dock(Scanner sc) { super(sc); }
public String toString() { String st = “Dock: ” + super.toString();
xx(xxxx == xxxx) {
xxxxxx xx;
}
xx += “x ” + xxxx;
xxxxxx xx;
} // xxx xxxxxx xxxxxxxx
Preview Job.java
xxxxxx xxxx.xxxx.xxxxxxxxx;
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxx xxxxxxx xxxxx {
double duration; ArrayList
requirements = new ArrayList
(); // should be some of the skills of the persons
public Job(Scanner sc) { super(sc); if (sc.hasNextDouble()) {
xxxxxxxx = xx.xxxxxxxxxx();
}
xxxxx (xx.xxxxxxx()) {
xxxxxx xx = xx.xxxx();
xxx (xxxxxx xx : xxxxxxxxxxxx) { // xxxxx xx xxxxxx xx xxxxx
xx (xx.xxxxxx(xx)) {
Preview PassengerShip.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxxxxxxxxxxx xxxxxxx xxxx {
xxx xxxxxxxxxxxxxxxxxxxxx;
int numberOfPassengers; int numberOfRooms;
public PassengerShip(Scanner sc) { super(sc); if(sc.hasNextInt()) { numberOfPassengers = sc.nextInt();
}
xx(xx.xxxxxxxxxx()) {
xxxxxxxxxxxxx = xx.xxxxxxx();
}
xx(xx.xxxxxxxxxx()) {
xxxxxxxxxxxxxxxxxxxxx = xx.xxxxxxx();
Preview Person.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxxxx xxxxxxx xxxxx {
String skill;
public Person(Scanner sc) { super(sc); if (sc.hasNext()) { skill = sc.next(); }
} // xxx xxxxxxx xxxxxxxxxxx
xxxxxx xxxxxx xxxxxxxx() {
xxxxxx xx = “xxxxxx: ” + xxxxx.xxxxxxxx() + ” ” + xxxxx;
xxxxxx xx;
} // xxx xxxxxx xxxxxxxx
Preview PortTime.java
public class PortTime {
int time;
xxx xxxx;
}
Preview SeaPort.java
xxxxxx xxxx.xxxx.xxxxxxxxx;
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxxxxx xxxxxxx xxxxx {
ArrayList
docks = new ArrayList
(); // the list of docks at the port ArrayList
que = new ArrayList
(); // the list of ships waiting to dock ArrayList
ships = new ArrayList
(); // the list of all the ships at this port ArrayList
person = new ArrayList
(); // people with skills at this port
public SeaPort(Scanner sc) { super(sc);
}
xxxxxx xxxxxx xxxxxxxx() {
xxxxxx xx = “xxxxxxxxx: ” + xxxxx.xxxxxxxx() + ‘x’;
xxx(xxxx xx: xxxxx) {
xx += “x” + xx;
Preview SeaPortsProgram.java
xxxxxx xxxxx xxxxxxxxxxxxxxx xxxxxxx xxxxxx {
xxxxxx xxxxx xxxx xxxxxxxxxxxxxxxx = 123x;
World world; // Initiates and runs on all created objects
HashMap
hms = new HashMap
(); HashMap
hmd = new HashMap
(); HashMap
hmp = new HashMap
();
JTextArea jta = new JTextArea(); JComboBox
jcb; JTextField jtf; Scanner scin; File selectedFile;
xxxxxx xxxxxxxxxxxxxxx() {
xxxxxxxx(“xxx xxxxx”);
xxxxxxx(600, 600);
xxxxxxxxxxxxxxxxxxxxxxxx(xxxxxx.xxxx_xx_xxxxx);
xxxxxxxxxx(xxxx);
Preview Ship.java
xxxxxx xxxx.xxxx.xxxxxxxxx;
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxx xxxxxxx xxxxx {
PortTime arrivalTime = new PortTime(); PortTime dockTime = new PortTime(); double draft, length, weight, width; ArrayList
jobs = new ArrayList
();
public Ship(Scanner sc) { super(sc);
xx(xx.xxxxxxxxxxxxx()) {
xxxxxx = xx.xxxxxxxxxx();
}
xx(xx.xxxxxxxxxxxxx()) {
xxxxxx = xx.xxxxxxxxxx();
}
Preview Thing.java
xxxxxx xxxx.xxxx.xxxxxxx;
xxxxxx xxxxx xxxxx xxxxxxxxxx xxxxxxxxxx
{
int index; String name; int parent;
public Thing() { name = “”; index = 0;
xxxxxx = 0;
} // xxx xx xxxxxxxxx xxxxxxxxxxx
xxxxxx xxxxx(xxxxxxx xx) {
xx(xx.xxxxxxx()) {
xxxx = xx.xxxx();
Preview World.java
xxxxx(xxxx.xxxxxxxxxxx()) {
xxxxxxx(xxxx.xxxxxxxx());
}
}
public String toString() { String st = ”

——- The World ——-“; if(ports.size() == 0) { return st; } for(SeaPort msp: ports) { st += msp; } return st; }
public void process(String st) {
xxxxxxx xx = xxx xxxxxxx(xx);
xx(!xx.xxxxxxx()) {
xxxxxx;
}
xxxxxx(xx.xxxx()) {
xxxx “xxxx”:
Preview readme.txt
Use Netbeans to open and run Seaport project
Price: $40
Buy Now
Checkout
Added to cart
Add to Cart
Checkout
Added to cart

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.