Question: Can someone please show the java code that fits this problem description using loops and not switch? Information: The sub - classes ( they are
Can someone please show the java code that fits this problem description using loops and not switch?
Information:
The subclasses they are already created and their fields are including all setters and getters
Yacht: private int numStateRooms;
int poolSize;
int numDecks;
int power;
int engineSize;
CruiseShip: int numOfExecStateRooms;
int numOfDoubleBunkRooms;
int numOfQuadBunkRooms;
CaargoShip: int maxCargo;
int refrigiratedStorage;
The superclass is Ship its fields are String name;
String nation;
int year;
int length;
int draft;
int beam;
SubClasses have already been created.
Problem description:
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. The initial list will only need the basic ship information
but when creating the displays when one of the buttons is
clicked, you must provide the additional information of the
individual sub ship.After data is loaded configure
a popup as s using the showOptionsDialog static method of the JOptionPane class.The Option buttons on this popuppngs of corresponding ship should be for each sub
ship and one to quit the program. Clicking on one of the sub
ship options will produce the popups.Next implement a program loop that will allow you to
click on one of the four option buttons until the quit button is created. Displays must be created outside of the file reading loop
using the instanceOf operator to determine the type of
object it is
Purpose: load all information from the
unique subclasses into a list of the superclass.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
