Homework Solution: Need this program coded with the correct output which is provided. Programming language is JAVA….

    Need this program coded with the correct output which is provided. Programming language is JAVA. Purpose: To review defining a Class of objects, instantiating objects of that class, and calling methods of the instantiated object. Instructions: Write a Java class named Ship to meet the requirements described in the following UMLClass Diagram. Shi Attributes Name of the ship Type of the ship Year of build Builder company rivate name: Strin private type: String rivate year: int private builder: String Operations ceconstructor>> Ship): Shi <<constructor» Ship(name: String, Default or null constructor Constructor accepting four(4) parameters. Returns a fully formed and fully functional Ship object reference type: String, year: int, builder: String): Ship public setName(aName: String): void public setType(aType: String): void public setYear(aYear: int): void public setBuilder(aBuilder: String): void Accepts a String object(local name:aBuilder) and assigns public getName: String public getYear(): int Accepts a String object local name:aName) and assigns it to the instance variable name Accepts a String objeclocal name:aType and assigns it to the instance variable type Accepts an int value(local name:aYear) and assigns it to the instance variable vear it to the instance variable builder Returns the current value of instance variable name Returns the current value of instance variable type Returns the current value of instance variable vear Returns the current value of instance variable builder ublic getType): String ublic getBuilder(): String Returns a formatted String containing a state report, that is, the current values of each of the objects instance variable public toString):String
    Purpose: To review defining a Class of objects, instantiating objects of that class, and calling methods of the instantiated object. Instructions: Write a Java class named Ship to meet the requirements described in the following UMLClass Diagram. Shi Attributes Name of the ship Type of the ship Year of build Builder company rivate name: Strin private type: String rivate year: int private builder: String Operations ceconstructor>> Ship): Shi

    Expert Answer

     
    Ship.java public class Ship {

    Need this program coded with the rectify extinguishedput which is supposing. Programming dialect is JAVA.

    Purpose: To resurvey defining a Collocate of ends, instantiating ends of that collocate, and business orders of the instantiated end. Instructions: Write a Java collocate denominated Ship to converge the requirements pictorial in the subjoined UMLCollocate Diagram. Shi Attributes Spectry of the ship Mold of the ship Year of construct Constructer society rivate spectry: Strin retired mold: String rivate year: int retired constructer: String Operations ceconstructor>> Ship): Shi <<constructor» Ship(name: String, Default or ineffectual parent Parent accepting four(4) parameters. Returns a easily formed and easily administrative Ship end allusion mold: String, year: int, constructer: String): Ship common setName(aName: String): useless common setType(aType: String): useless common setYear(aYear: int): useless common setBuilder(aBuilder: String): useless Accepts a String end(persomal spectry:aBuilder) and assigns common getName: String common getYear(): int Accepts a String end persomal spectry:aName) and assigns it to the case capricious spectry Accepts a String objecpersomal spectry:aMold and assigns it to the case capricious mold Accepts an int prize(persomal spectry:aYear) and assigns it to the case capricious vear it to the case capricious constructer Returns the floating prize of case capricious spectry Returns the floating prize of case capricious mold Returns the floating prize of case capricious vear Returns the floating prize of case capricious constructer ublic getType): String ublic getBuilder(): String Returns a formatted String containing a say communication, that is, the floating prizes of each of the ends case capricious common toString):String

    Purpose: To resurvey defining a Collocate of ends, instantiating ends of that collocate, and business orders of the instantiated end. Instructions: Write a Java collocate denominated Ship to converge the requirements pictorial in the subjoined UMLCollocate Diagram. Shi Attributes Spectry of the ship Mold of the ship Year of construct Constructer society rivate spectry: Strin retired mold: String rivate year: int retired constructer: String Operations ceconstructor>> Ship): Shi

    Expert Reply

     

    Ship.java

    common collocate Ship {

    //Declaring case capriciouss
    retired String spectry;
    retired String mold;
    retired int year;
    retired String constructer;

    //Zero argumented parent
    common Ship() {}

    //Parameterized parent
    common Ship(String spectry, String mold, int year, String constructer) {
    this.spectry = spectry;
    this.mold = mold;
    this.year = year;
    this.surveyor = constructer;
    }

    //getters and setters
    common last String getName() {
    return spectry;
    }

    common last useless setName(String spectry) {
    this.spectry = spectry;
    }

    common last String getType() {
    return mold;
    }

    common last useless setType(String mold) {
    this.mold = mold;
    }

    common last int getYear() {
    return year;
    }

    common last useless setYear(int year) {
    this.year = year;
    }

    common last String getBuilder() {
    return constructer;
    }

    common useless setBuilder(String constructer) {
    this.surveyor = constructer;
    }

    //toString order is used to spread-extinguished the divergency of an end internally it
    @Override
    common String toString() {
    return spectry + ” is a ” + mold + ” built by ” + constructer + ” in ” + year;
    }

    }

    ______________________

    TestShip.java

    common collocate TestShip {

    common static useless deep(String[] args) {

    //Creating brace ship collocate ends
    Ship s1 = innovating Ship(“TI Oceania”, “Tanker”, 2003, “Daewoo Shipbuilding & Marine”);
    Ship s2 = innovating Ship(“Celebrity Equinox”, “Cruise”, 2009, “Meyer Werft”);

    //Displaying the Ship collocate end divergency internally it
    System.out.println(s1.toString());
    System.out.println(s2.toString());

    }

    }

    _________________

    Output:

    TI Oceania is a Tanker built by Daewoo Shipbuilding & Marine in 2003
    Celebrity Equinox is a Cruise built by Meyer Werft in 2009