Question
Java Only please Expected toString output Your output need not be identical to that shown here, but you must include all instance values in the
Java Only please
Expected toString output Your output need not be identical to that shown here, but you must include all instance values in the output, in the order shown.
TI Oceania is a(n) Oil Tanker with a volume capacity of 503410 cubic meters built by Daewoo Shipbuilding & Marine Engineering in 2003.
Celebrity Equinox is a Luxury Cruise with a passenger capacity of 2850 passengers built by Meyer Werft in 2009.
Hint: To test your Classes, you can write a testShip class with a main() method, that instantiates objects from both Tanker and Cruise classes.
Instructions Modify class Ship to meet the revised requirements described in the following UML Class Diagram Ship Attributes private name: String private year: int private builder: String Name of the ship Year of build Builder company Operations Ship(name: String, Default or null constructor Constructor accepting three (3) parameters. Returns a fully formed and fully functional Ship object reference year: int, builder: String): Ship public setName(aName: String): void public setYear(aYear: int): void public setBuilder(aBuilder: String): voidAccepts a String object local name:aBuilder) and assigns Accepts a String object(local name:aName) and assigns it to the instance variable name Accepts an int value(local name:aYear) and assigns it to the instance variable year ublic getName): String ublic getYear): int ublic getBuilder(): String it to the instance variable builder Returns the current value of instance variable name Returns the current value of instance variable vear Returns the current value of instance variable builder Returns a formatted String containing a 'state report', that is, the current values of each of the object's instance variable public toString(): StringStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started