Question: Code a class called RoyalCaribbean. Code a default constructor. Code an overloaded constructor that accepts the name of the ship, its port of departure, its

Code a class called RoyalCaribbean. Code a default constructor. Code an overloaded constructor that accepts the name of the ship, its port of departure, its destination, departure date (dateDepart should only be a String), and average cost of the voyage (in that order). Assign the parameter variables to instance fields with the same name. Code getVoyageInfo() that returns a formatted String of the fields' contents.
Instantiate an object of the RoyalCaribbean class in TestRoyalCaribbean using its overloaded constructor to populate the object; then, use the get method to print the object's content.

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 Programming Questions!