Question: could someone please finish this program it has on super class called ship and 3 sub classes with all setters and getters. Please add in

could someone please finish this program it has on super class called ship and 3 sub classes with all setters and getters. Please add in the code that does this
create a driver class called FlotillaDriver that is
required to do specific tasks.
Open the text file called flotilla.csv and load all ship using
the appropriate subclass into an ArrayList dedicated to the
super class Ship.
Instantiate the proper sub ship object to add to the list. You
might need only the basic ship information in the initial list,
but when creating the displays using JOptionPane when one of the buttons is
clicked, you must provide the additional information of the
individual sub ship. Yoy should master the specific technique of loading all information from the
unique subclasses into a list of the superclass.
The organization for each line of data within the file starts
with the subship code that lets you know what type of sub
ship you have. The next six fields are the ships name, year of
built, country of registration, length, draft and beam. The
data following this depends on the the type of ship represent
ed. For the Yacht, there are four additional fields indicating the
number of state rooms, the size of the pool, the number of
decks and the size of the engine.
For the Cruise ship, there are three additional fields indicat
ing the number of executive room, the number of double
rooms and the number of quad rooms.
For the Cargo Ship, there are two additional fields indicating
the maximum weight of cargo allowed and the amount of re
frigerated storage the ship has. At this point you will need to use a decision structure using loops and if statements
based on the subship code to determine how to access the
data.After you have successfully loaded the data, you need to con
figure a popup using the showOptionsDialog static method of the JOptionPane class.The Option buttons on this pop-up should be for each sub
ship and one to quit the program. Clicking on one of the subship options will produce the popups.
code so far:
class Ship
{
private String name; // Ship name
private String nation; // Nation of registry
private int year; //4 digit year built
private int length; // Length of ship at mean draft
private int draft; // average depth below sea level
private int beam; // side to side width at mean draft
public Ship(String nam, String nat, int yer, int len, int dra, int bem)
{
name = nam;
year = yer;
nation = nat;
length = len;
draft = dra;
beam = bem;
}
public int calculateDisplacment()
{
return length*beam*draft;
}
public void setName(String n)
{
name = n;
}
public void setNation(String na)
{
nation = na;
}
public String getName()
{
return name;
}
public int getYear()
{
return year;
}
public String getNation()
{
return nation;
}
public String toString()
{
return name +","+
year +","+
nation+","+
"Size: "+length +" by "+beam+" by "+draft;
}
public int getLength(){
return length;
}
public int getDraft(){
return draft;
}
public int getBeam(){
return beam;
}
}
Sub-class:
public class CargoShip extends Ship{
private int maxCargo;
private int refrigiratedStorage;
public CargoShip( String nam, String nat, int yer, int len, int dra,
int bem, int mcg, int rst)
{
super(nam, nat, yer, len, dra, bem);
maxCargo = mcg;
refrigiratedStorage = rst;
}
public String toString()
{
return super.toString()+ maxCargo +","+ refrigiratedStorage +",";
}
public int getMaxCargo(){
return maxCargo;
}
public void setMaxCargo(int maxCargo){
this.maxCargo = maxCargo;
}
public double getRefrigiratedStorage(){
return refrigiratedStorage;
}
public void setRefrigiratedStorage(int refrigiratedStorage){
this.refrigiratedStorage = refrigiratedStorage;
}
}
sub-class
public class Yacht extends Ship {
private int numStateRooms;
private int poolSize;
private int numDecks;
private int power;
private int engineSize;
public Yacht(String nam, String nat, int yer, int len, int dra, int bem,
int nsr,int pSize, int numDec, int pow, int eSize)
{
super(nam, nat, yer, len, dra, bem);
numStateRooms = nsr;
poolSize = pSize;
numDecks = numDec;
power = pow;
engineSize = eSize;
}
public String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!