Write My Paper Button

WhatsApp Widget

Project 1 Introduction – The SeaPort Project Series For This Set Of Projects For The Course, 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 O Variables Used By The GUI Interface O World: World  Thing Implement Comparable

SeaPort Project Series For This Set Of Projects For The Course, 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:

INSTRUCTIONS TO CANDIDATES

ANSWER ALL QUESTIONS
1
Project 1
Introduction - The SeaPort Project Series
For This Set Of Projects For The Course, 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
O Variables Used By The GUI Interface
O World: World
 Thing Implement Comparable 
O Index: Int
O Name: String
O Parent: Int
 World Extends Thing
O Ports: ArrayList 
O Time: PortTime
 SeaPort Extends Thing
O Docks: ArrayList 
O Que: ArrayList  // The List Of Ships Waiting To Dock
O Ships: ArrayList  // A List Of All The Ships At This Port
O Persons: ArrayList  // People With Skills At This Port
 Dock Extends Thing
O Ship: Ship
 Ship Extends Thing
O ArrivalTime, DockTime: PortTime
O Draft, Length, Weight, Width: Double
O Jobs: ArrayList 
 PassengerShip Extends Ship
O NumberOfOccupiedRooms: Int
O NumberOfPassengers: Int
O NumberOfRooms: Int
 CargoShip Extends Ship
O CargoValue: Double
O CargoVolume: Double
O CargoWeight: Double
 Person Extends Thing
O Skill: String
 Job Extends Thing - Optional Till Projects 3 And 4
O Duration: Double
O Requirements: ArrayList 
// Should Be Some Of The Skills Of The Persons
 PortTime
O Time: Int
Eventually, In Projects 3 And 4, You Will Be Asked To Show The Progress Of The Jobs Using JProgressBar's.
2
Here's A Very Quick Overview Of All Projects:
1. Read A Data File, Create The Internal Data Structure, Create A GUI To Display The Structure, And Let
The User Search The Structure.
2. Sort The Structure, Use Hash Maps To Create The Structure More Efficiently.
3. Create A Thread For Each Job, Cannot Run Until A Ship Has A Dock, Create A GUI To Show The
Progress Of Each Job.
4. Simulate Competing For Resources (Persons With Particular Skills) For Each Job.
Project 1 General Objectives
Project 1 - Classes, Text Data File, GUI, Searching
 Define And Implement Appropriate Classes, Including:
O Instance And Class Variables,
O Constructors,
O ToString Methods, And
O Other Appropriate Methods.
 Read Data From A Text File:
O Specified At Run Time,
 JFileChooser Jfc = New JFileChooser (".");
// Start At Dot, The Current Directory
O Using That Data To Create Instances Of The Classes,
O Creating A Multi-Tree (Class Instances Related In Hierarchical, Has-Some, Relationships),
And
O Organizing Those Instances In Existing JDK Structures Which Can Be Sorted, Such As
ArrayList's.
 Create A Simple GUI:
O Presenting The Data In The Structures With With Some Buttons And
O Text Fields Supporting SEARCHING On The Various Fields Of Each Class.
Documentation Requirements:
You Should Start Working On A Documentation File Before You Do Anything Else With These Projects, And
Fill In Items As You Go Along. Leaving The Documentation Until The Project Is Finished Is Not A Good Idea For
Any Number Of Reasons.
The Documentation Should Include The Following (Graded) Elements:
 Cover Page (Including Name, Date, Project, Your Class Information)
 Design
O Including A UML Class Diagram
O Classes, Variables And Methods: What They Mean And Why They Are There
O Tied To The Requirements Of The Project
 User's Guide
O How Would A User Start And Run Your Project
O Any Special Features
3
O Effective Screen Shots Are Welcome, But Don't Overdo This
 Test Plan
O Do This BEFORE You Code Anything
O What Do You EXPECT The Project To Do
O Justification For Various Data Files, For Example
 Lessons Learned
O Express Yourself Here
O A Way To Keep Good Memories Of Successes After Hard Work
Project 1 Specific Goals:
1. Create A GUI
2. Let The User Select A Data File, Using JFileChooser
3. Read The Data File, Creating The Specified Internal Data Structure (See The Introduction For The
Classes And Variables Of The Structure).
4. Display The Internal Data Structure In A Nice Format In The GUI
1. Use JScrollPane And JTextArea
5. Display The Results Of A Search Specified By The User
1. JTextField To Specify The Search Target
2. Searching Targets: Name, Index, Skill Would Be A Minimum
You Are Encouraged To Provide Other Options
3. Note That A Search May Return More Than One Item
4. DO NOT Create New Data Structures (Beyond The Specified Internal Data Structure) To
Search
You May Create A Structure Of Found Items As A Return Value
Data File Format:
 Each Item In The Simulation Will Appear On A Single Line Of The Data File.
 The Data File May Have Comment Lines, Which Will Start With A //.
 There May Be Blank Lines In The Data File, Which Your Program Should Accept And Ignore.
 The Data Lines Will Start With One Of The Following Flag Values, Indicating Which Item Is Being
Specified, Its Name, Its Index, And The Index Of Its Parent - Which Is Used To Specify The
Connections Used To Create The Internal Data Structure (Ie, Assign An Item To It Parent Or Parent
ArrayList).
 For Most Items There Will Be Additional Fields Appropriate To The Class Of That Item.
 The Fields On A Line Are Space Delimited (Perhaps More Than One Space)
O This Works Well With Scanner Methods, Such As Next(), NextInt() And NextDouble().
Here Are The Details Of Valid Lines, With An Example Of Each Line.
// Port Name Index Parent(Null)
// Port   
Port Kandahar 10002 0
4
// Dock Name Index Parent(Port)
// Dock   
Dock Pier_5 20005 10001 30005
// Ship Name Index Parent(Dock/Port) Weight Length Width Draft
// Ship       
 Ship Reason 40003 10000 165.91 447.15 85.83 27.07
// Cship Name Index Parent(Dock/Port) Weight Length Width Draft CargoWeight CargoVolume CargoValue
// Cship          
 Cship Suites 40003 10000 165.91 447.15 85.83 27.07 125.09 176.80 857.43
// Pship Name Index Parent(Dock/Port) Weight Length Width Draft NumPassengers NumRooms
NumOccupied
// Pship          
 Pship "ZZZ_Hysterics" 30002 20002 103.71 327.92 56.43 30.23 3212 917 917
// Person Name Index Parent Skill
// Person    
 Person Alberto 50013 10001 Cleaner
// Job Name Index Parent Duration [Skill]* (Zero Or More, Matches Skill In Person, May Repeat)
// Job     []* (Ie, Zero Or More)
 Job Job_10_94_27 60020 30007 77.78 Carpenter Cleaner Clerk
You May Assume That The Data File Is Correctly Formatted And That The Parent Links Exist And Are
Encountered In The Data File As Item Indices Before They Are Referenced As Parent Links.
There Is A Java Program (CreateSeaPortDataFile.Java) Provided With This Package That Will Generate Data
Files With Various Characteristics With The Correct Format. You Should Be Using The Program To Generate
Your Own Data Files To Test Various Aspects Of Your Project Programs.
Sample Input File:
// File: ASPaa.Txt
// Data File For SeaPort Projects
// Date: Sat Jul 09 22:51:16 EDT 2016
// Parameters: 1 1 5 5 1 5
// Ports, Docks, Pships, Cships, Jobs, Persons
// Port Name Index Parent(Null)
// Port   
Port Lanshan 10000 0
// Dock Name Index Parent(Port)
// Dock   
Dock Pier_4 20004 10000 30004
5
Dock Pier_0 20000 10000 30000
Dock Pier_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
// Cship          
 Cship Erosional 40001 10000 200.80 242.33 38.31 23.49 172.73 188.54 235.57
 Cship Kielbasas 40000 10000 120.85 362.55 96.82 19.09 33.08 188.31 261.57
 Cship Generics 40002 10000 79.90 234.26 73.18 15.71 125.27 179.00 729.95
 Cship Barcelona 40003 10000 219.92 443.54 104.44 34.16 86.69 139.89 813.72
 Cship Toluene 40004 10000 189.12 448.99 73.97 37.67 88.90 175.03 1002.63
// Person Name Index Parent Skill
// Person    
 Person Sara 50000 10000 Electrician
 Person Duane 50002 10000 Inspector
 Person Betsy 50004 10000 Cleaner
 Person Archie 50003 10000 Captain
 Person Thomas 50001 10000 Clerk
Sample Output As Plain Text - Which Should Be Displayed In A JTextArea On A JScrollPane In The
BorderLayout.CENTER Area Of A JFrame:
>>>>> The World:
SeaPort: Lanshan 10000
Dock: Pier_4 20004
 Ship: Passenger Ship: Absentmindedness 30004
Dock: Pier_0 20000
 Ship: Passenger Ship: Gallinules 30000
Dock: Pier_1 20001
 Ship: Passenger Ship: Remora 30001
Dock: Pier_3 20003 
6
 Ship: Passenger Ship: Preanesthetic 30003
Dock: Pier_2 20002
 Ship: Passenger Ship: Shoetrees 30002
--- List Of All Ships In Que:
 > Cargo Ship: Erosional 40001
 > Cargo Ship: Kielbasas 40000
 > Cargo Ship: Generics 40002
 > Cargo Ship: Barcelona 40003
 > Cargo Ship: Toluene 40004
--- List Of All Ships:
 > Passenger Ship: Gallinules 30000
 > Passenger Ship: Remora 30001
 > Passenger Ship: Absentmindedness 30004
 > Passenger Ship: Preanesthetic 30003
 > Passenger Ship: Shoetrees 30002
 > Cargo Ship: Erosional 40001
 > Cargo Ship: Kielbasas 40000
 > Cargo Ship: Generics 40002
 > Cargo Ship: Barcelona 40003
 > Cargo Ship: Toluene 40004
--- List Of All Persons:
 > Person: Sara 50000 Electrician
 > Person: Duane 50002 Inspector
 > Person: Betsy 50004 Cleaner
 > Person: Archie 50003 Captain
 > Person: Thomas 50001 Clerk
Suggestions:
Methods That Should Be Implemented.
Each Class Should Have An Appropriate ToString Method. Here Is An Example Of Two Such Methods:
 In SeaPort - Showing All The Data Structures:
Public String ToString () {
 String St = "NnSeaPort: " + Super.ToString();
 For (Dock Md: Docks) St += "N" + Md;
 St += "Nn --- List Of All Ships In Que:";
 For (Ship Ms: Que ) St += "N > " + Ms;
 St += "Nn --- List Of All Ships:";
 For (Ship Ms: Ships) St += "N > " + Ms;
 St += "Nn --- List Of All Persons:";
 For (Person Mp: Persons) St += "N > " + Mp;
7
 Return St;
 } // End Method ToString
 In PassengerShip, Using Parent ToString Effectively:
 Public String ToString () {
 String St = "Passenger Ship: " + Super.ToString();
 If (Jobs.Size() == 0)
 Return St;
 For (Job Mj: Jobs) St += "N - " + Mj;
 Return St;
 } // End Method ToString
Each Class Should Have An Appropriate Scanner Constructor, Allowing The Class To Take Advantage Of
Super Constructors, And Any Particular Constructor Focusing Only On The Addition Elements Of Interest To
That Particular Class. As An Example, Here's One Way To Implement The PassengerShip Constructor:
 PassengerShip Scanner Constructor, The Earlier Fields Are Handled By Thing (Fields: Name, Index,
Parent) And Ship (Fields: Weight, Length, Width, Draft) Constructors.
 Public PassengerShip (Scanner Sc) {
 Super (Sc);
 If (Sc.HasNextInt()) NumberOfPassengers = Sc.NextInt();
 If (Sc.HasNextInt()) NumberOfRooms = Sc.NextInt();
 If (Sc.HasNextInt()) NumberOfOccupiedRooms = Sc.NextInt();
 } // End End Scanner Constructor
In The World Class, We Want To Read The Text File Line By Line. Here Are Some Useful Methods Types And
Code Fragments That You Should Find Helpful:
 Handling A Line From The File:
 Void Process (String St) {
 // System.Out.Println ("Processing >" + St + "<");
 Scanner Sc = New Scanner (St);
 If (!Sc.HasNext())
 Return;
 Switch (Sc.Next()) {
 Case "Port" : AddPort (Sc);
 Break;
 Finding A Ship By Index - Finding The Parent Of A Job, For Example:
 Ship GetShipByIndex (Int X) {
 For (SeaPort Msp: Ports)
 For (Ship Ms: Msp.Ships)
 If (Ms.Index == X)
 Return Ms;
 Return Null;
 } // End GetDockByIndex
 Linking A Ship To Its Parent:
 Void AssignShip (Ship Ms) {
 Dock Md = GetDockByIndex (Ms.Parent);
 If (Md == Null) {
8
 GetSeaPortByIndex (Ms.Parent).Ships.Add (Ms);
 GetSeaPortByIndex (Ms.Parent).Que.Add (Ms);
 Return;
 }
 Md.Ship = Ms;
 GetSeaPortByIndex (Md.Parent).Ships.Add (Ms);
 } // End Method AssignShip
You Will Probably Find The Comments In The Following Helpful, They Are Mostly About Similar Projects And
General Issues In Java Relevant To Our Programs:
 CMSC 335 Information
 Cave Strategy - Getting Started
Deliverables:
1. Java Source Code Files
2. Data Files Used To Test Your Program
3. Configuration Files Used
4. A Well-Written Document Including The Following Sections:
A. Design: Including A UML Class Diagram Showing The Type Of The Class Relationships
B. User's Guide: Description Of How To Set Up And Run Your Application
C. Test Plan: Sample Input And Expected Results, And Including Test Data And Results, With
Screen Snapshots Of Some Of Your Test Cases
D. Optionally, Comments: Design Strengths And Limitations, And Suggestions For Future
Improvement And Alternative Approaches
E. Lessons Learned
F. Use One Of The Following Formats: MS Word Docx Or PDF.
Your Project Is Due By Midnight, EST, On The Day Of The Date Posted In The Class Schedule. We Do Not
Recommend Staying Up All Night Working On Your Project - It Is So Very Easy To Really Mess Up A Project At
The Last Minute By Working When One Was Overly Tired.
Your Instructor's Policy On Late Projects Applies To This Project.
Submitted Projects That Show Evidence Of Plagiarism Will Be Handled In Accordance With UMUC Policy
150.25 — Academic Dishonesty And Plagiarism.
Format:
The Documentation Describing And Reflecting On Your Design And Approach Should Be Written Using
Microsoft Word Or PDF, And Should Be Of Reasonable Length. The Font Size Should Be 12 Point. The Page
Margins Should Be One Inch. The Paragraphs Should Be Double Spaced. All Figures, Tables, Equations, And
References Should Be Properly Labeled And Formatted Using APA Style.
9
Coding Hints:
 Code Format: (See Google Java Style Guide For Specifics
(Https://Google.Github.Io/Styleguide/Javaguide.Html))
O Header Comment Block, Including The Following Information In Each Source Code File:
O File Name
O Date
O Author
O Purpose
O Appropriate Comments Within The Code
O Appropriate Variable And Function Names
O Correct Indentation
 Errors:
O Code Submitted Should Have No Compilation Or Run-Time Errors
 Warnings:
O Your Program Should Have No Warnings
O Use The Following Compiler Flag To Show All Warnings:
Javac -Xlint *.Java
O More About Setting Up IDE's To Show Warnings
O Generics - Your Code Should Use Generic Declarations Appropriately, And To Eliminate All
Warnings
 Elegance:
O Just The Right Amount Of Code
O Effective Use Of Existing Classes In The JDK
O Effective Use Of The Class Hierarchy, Including Features Related To Polymorphism.
 GUI Notes:
O GUI Should Resize Nicely
O DO NOT Use The GUI Editor/Generators In An IDE (Integrated Development Environment,
Such As Netbeans And Eclipse)
O Do Use JPanel, JFrame, JTextArea, JTextField, JButton, JLabel, JScrollPane
 Panels On Panels Gives Even More Control Of The Display During Resizing
 JTable And/Or JTree For Projects 2, 3 And 4
 Font Using The Following Gives A Nicer Display For This Program, Setting For The
JTextArea Jta:
 Jta.SetFont (New Java.Awt.Font ("Monospaced", 0,
12));
O GridLayout And BorderLayout - FlowLayout Rarely Resizes Nicely
 GridBagLayout For Extreme Control Over The Displays
 You May Wish To Explore Other Layout Managers
O ActionListener, ActionEvent - Responding To JButton Events
 Starting With JDK 8, Lambda Expression Make Defining Listeners MUCH Simpler.
See The Example Below, With Jbr (Read), Jbd (Display) And Jbs (Search) Three
Different JButtons.
Jcb Is A JComboBox  And Jtf Is A JTextField.
 Jbr.AddActionListener (E -> ReadFile());
 Jbd.AddActionListener (E -> DisplayCave ());
 Jbs.AddActionListener (E -> Search
((String)(Jcb.GetSelectedItem()), Jtf.GetText()));
10
O JFileChooser - Select Data File At Run Time
O JSplitPane - Optional, But Gives User Even More Control Over Display Panels
Grading Rubric:
Attribute Meets Does Not Meet
Design 20 Points
Contains Just The Right Amount Of
Code.
Uses Existing Classes In The JDK
Effectively.
Effectively Uses Of The Class
Hierarchy, Including Features
Related To Polymorphism.
0 Points
Does Not Contain Just The Right Amount
Of Code.
Does Not Use Existing Classes In The JDK
Effectively.
Does Not Effectively Use Of The Class
Hierarchy, Including Features Related To
Polymorphism.
Functionality 40 Points
Contains No Coding Errors.
Contains No Compile Warnings.
Creates A GUI.
Lets The User Select A Data File,
Using JFileChooser.
Reads The Data File, Creating The
Specified Internal Data Structure .
Displays The Internal Data Structure
In A Nice Format In The GUI.
Displays The Results Of A Search
Specified By The User.
0 Points
Contains Coding Errors.
Contains Compile Warnings.
Does Not Create A GUI.
Does Not Let The User Select A Data File,
Using JFileChooser.
Does Not Read The Data File, Creating
The Specified Internal Data Structure.
Does Not Display The Internal Data
Structure In A Nice Format In The GUI.
Does Not Display The Results Of A Search
Specified By The User.
Test Data 20 Points
Tests The Application Using Multiple
And Varied Test Cases.
0 Points
Does Not Test The Application Using
Multiple And Varied Test Cases.
Documentation And
Submission
15 Points
Source Code Files Include Header
Comment Block, Including File
Name, Date, Author, Purpose,
Appropriate Comments Within The
Code, Appropriate Variable And
0 Points
Source Code Files Do Not Include Header
Comment Block, Or Include File Name,
Date, Author, Purpose, Appropriate
Comments Within The Code, Appropriate
Variable And Function Names, Correct
Indentation. 
11
Function Names, Correct
Indentation.
Submission Includes Java Source
Code Files, Data Files Used To Test
Your Program, Configuration Files
Used.
Documentation Includes A UML
Class Diagram Showing The Type Of
The Class Relationships.
Documentation Includes A User's
Guide Describing Of How To Set Up
And Run Your Application.
Documentation Includes A Test Plan
With Sample Input And Expected
Results, Test Data And Results And
Screen Snapshots Of Some Of Your
Test Cases.
Documentation Includes Lessons
Learned.
Documentation Is In An Acceptable
Format.
Submission Does Not Include Java
Source Code Files, Data Files Used To Test
Your Program, Configuration Files Used.
Documentation Does Not Include A UML
Class Diagram Showing The Type Of The
Class Relationships.
Documentation Does Not Include A
User's Guide Describing Of How To Set
Up And Run Your Application.
Documentation Does Not Include A Test
Plan With Sample Input And Expected
Results, Test Data And Results And Screen
Snapshots Of Some Of Your Test Cases.
Documentation Does Not Include
Lessons Learned.
Documentation Is Not In An Acceptable
Format.
Documentation Form,
Grammar And Spelling
5 Points
Document Is Well-Organized.
The Font Size Should Be 12 Point.
The Page Margins Should Be One
Inch.
The Paragraphs Should Be Double
Spaced.
All Figures, Tables, Equations, And
References Should Be Properly
Labeled And Formatted Using APA
Style.
The Document Should Contain
Minimal Spelling And Grammatical
Errors.
0 Points
Document Is Not Well-Organized.
The Font Size Is Not 12 Point.
The Page Margins Are Not One Inch.
The Paragraphs Are Not Double Spaced.
All Figures, Tables, Equations, And
References Are Not Properly Labeled Or
Formatted Using APA Style.
The Document Should Contains Many
Spelling And Grammatical Errors.
     (5/5)

CLAIM YOUR 30% OFF TODAY

X
Don`t copy text!
WeCreativez WhatsApp Support
Our customer support team is here to answer your questions. Ask us anything!
???? Hi, how can I help?