Project for khangcnttit92 -- 2
$15 USD
Pagato alla consegna
Hi khangcnttit92, I have another java project that shouldn't take you more than a half hour
Module 10 Chapter 11 Programming Assignment
For this project you will create the classes Ship, CruiseShip, CargoShip, & LiveAboardDiveBoat. The classes CruiseShip & CargoShip inherit directly from the class Ship, the class LiveAboardDiveBoat extends the class CruiseShip.
The class Ship should have a field for the name of the ship (a string), a field for the year that the ship was built (an int), and a field for the ship's capacity (an int). It should have a constructor method and any needed accessor & mutator methods (i.e., gets & sets). It should also have a toString method that displays the ship's name and the year that it was built.
The class CruiseShip extends the class Ship. The capacity for a CruiseShip is the number of passengers that it can carry. The class CruiseShip should include a constructor along with any needed accessor & mutators. It should have a toString method that displays the ship's name, the year that it was built, and the number of passengers.
The class CargoShip extends the class Ship. The capacity for a CargoShip is the tonnage that it can carry. The class CargoShip should include a constructor along with any needed accessor & mutator methods. It should have a toString method that displays the ship's name, the year that it was built, and the tonnage that it can carry.
The class LiveAboardDiveBoat extends the class CruiseShip. The class CruiseShip should have a boolean field that indicates whether or not Nitrox (a specialized diving gas) is available onboard. The class LiveAboardDiveBoat should include a constructor with any needed accessor & mutator methods. It should have a toString method that displays the ship's name, the year that it was built, the number of passengers that it can carry, and the statement "Nitrox available" or "no Nitrox" as appropriate.
Create an array of 10 Ships. Populate the array with a variety of CruiseShips, CargoShips, & LiveAboardDiveBoats (at least 2 of each, but a total of 10 ships). Step through the array, calling each ship's toString method; display the information for each ship on a single line of output. Use console I/O for this problem.
Rif. progetto: #10034303