Create a class named Ship that has two private fields one for the name (string) of the ship, and the other for the year (string) the ship was built. The class contains a parameterized constructor to set the values of each field get methods for each of the fields display method to display ship’s information. Create a class named CruiseShip that extends Ship class. CruiseShip class should have a private field for the maximum number of passengers (int). The class contains - a parameterized constructor to set the value of the field - get and set method for the field - a display method that overrides ship class display method and display CruiseShip information. Create an application/class named CruiseShipDemo that allows a user to enter values to create 5 CruiseShip objects and save them in the array. Display the records. The CruiseShipDemo class should have a method named update to update the CruiseShips information. The method prompts the user for the ship name, if the requested record does not exist, issue an error message. Otherwise, prompt the user for the new value for the maximum number of passengers and update the record in the database. Assume that records are unique. Demonstrate the method and display the updated record.
Create a class named Ship that has two private fields one for the name (string)
of the ship, and the other for the year (string) the ship was built. The class
contains
a parameterized constructor to set the values of each field
get methods for each of the fields
display method to display ship’s information.
Create a class named CruiseShip that extends Ship class. CruiseShip class should have a private field for the maximum number of passengers (int).
The class contains
- a parameterized constructor to set the value of the field
- get and set method for the field
- a display method that overrides ship class display method and
display CruiseShip information.
Create an application/class named CruiseShipDemo that allows a user to
enter values to create 5 CruiseShip objects and save them in the array. Display the records.
The CruiseShipDemo class should have a method named update to update
the CruiseShips information. The method prompts the user for the ship name, if the requested record does not exist, issue an error message. Otherwise,
prompt the user for the new value for the maximum number of passengers
and update the record in the
Demonstrate the method and display the updated record.
Step by step
Solved in 4 steps with 2 images