Question: This class will represent a Fleet object, which we will define as having: A name, represented as a String (e.g. United Federation of Planets) An

This class will represent a Fleet object, which we will define as having:

A name, represented as a String (e.g. United Federation of Planets)

An ArrayList of Starship objects

A constructor which requires all String fields and initializes the collection

A getSizeOfFleet() method which returns the number of starships in the fleet

An addStarship(..) method which takes a Starship parameter and adds it to the fleet, returning nothing.

A toString() method which calls upon the toString() in Starship to return a string representation of the fleet.

Getters and setters for all fields

A loadStarships() method which takes in a directory name and adds a Starship to the Fleet for each file found. This method should not return anything and needs to throw an exception in order to allow for file I/O. To do this you need only define your method as follows: public void loadStarships( String directoryName ) throws FileNotFoundException {

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!