$30
Question 1
Declare and implement an abstract class called Ship that has the following:
§ An attribute to represent the name of the ship.
§ An attribute to represent the year that the ship was built.
§ A default constructor to initialize the attributes.
§ Accessor methods and mutator methods for each of the attribute.
§ An abstract method called displayDetails().
Declare and design a subclass of Ship called CruiseShip. The CruiseShip class should have the following: § An additional attribute to keep the maximum number of passengers.
§ A default constructor to initialize the attribute in CruiseShip as well as the Ship class. § Accessor methods and mutator methods for its attribute.
§ The displayDetails()method that will display all details from Ship and CruiseShip.
Declare and implement another subclass of Ship called CargoShip. The CargoShip class should have the following:
§ An attribute to keep the cargo capacity in tonnage.
§ A default constructor to initialize the attribute in CargoShip as well as the Ship class. § Accessor methods and mutator methods for its attribute.
§ The displayDetails()method that will display all details from Ship and CargoShip.
Write a main() method in another class called ShipApp. Declare an ArrayList<Ship to keep several CruiseShip and CargoShip objects. Use a simple menu to allow the user to
(1) add either a CruiseShip or a CargoShip
(2) edit either the number of passengers for a CruiseShip or the cargo capacity for the CargoShip
(3) display all the objects in the ArrayList.