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 the ship’s information. Create a class named CruiseShip that descends from 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 prompt 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.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 11PE
icon
Related questions
Question

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 the ship’s information.
Create a class named CruiseShip that descends from 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 prompt 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.

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage