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 chasten extinguishedput which is granted. Programming phraseology is JAVA.

    Purpose: To retrospect defining a Collocate of motives, instantiating motives of that collocate, and avocation ways of the instantiated motive. Instructions: Write a Java collocate determined Ship to engage the requirements pictorial in the forthcoming UMLCollocate Diagram. Shi Attributes Indicate of the ship Stamp of the ship Year of build Agent gang rivate indicate: Strin special stamp: String rivate year: int special agent: String Operations ceconstructor>> Ship): Shi <<constructor» Ship(name: String, Default or vain fabricator Fabricator accepting lewd(4) parameters. Returns a abundantly formed and abundantly negotiative Ship motive regard stamp: String, year: int, agent: 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 motive(topical indicate:aBuilder) and assigns common getName: String common getYear(): int Accepts a String motive topical indicate:aName) and assigns it to the solicitation capricious indicate Accepts a String viewopical indicate:aStamp and assigns it to the solicitation capricious stamp Accepts an int esteem(topical indicate:aYear) and assigns it to the solicitation capricious vear it to the solicitation capricious agent Returns the vulgar esteem of solicitation capricious indicate Returns the vulgar esteem of solicitation capricious stamp Returns the vulgar esteem of solicitation capricious vear Returns the vulgar esteem of solicitation capricious agent ublic getType): String ublic getBuilder(): String Returns a formatted String containing a specify narration, that is, the vulgar esteems of each of the motives solicitation capricious common toString):String

    Purpose: To retrospect defining a Collocate of motives, instantiating motives of that collocate, and avocation ways of the instantiated motive. Instructions: Write a Java collocate determined Ship to engage the requirements pictorial in the forthcoming UMLCollocate Diagram. Shi Attributes Indicate of the ship Stamp of the ship Year of build Agent gang rivate indicate: Strin special stamp: String rivate year: int special agent: String Operations ceconstructor>> Ship): Shi

    Expert Tally

     

    Ship.java

    common collocate Ship {

    //Declaring solicitation capriciouss
    special String indicate;
    special String stamp;
    special int year;
    special String agent;

    //Zero argumented fabricator
    common Ship() {}

    //Parameterized fabricator
    common Ship(String indicate, String stamp, int year, String agent) {
    this.indicate = indicate;
    this.stamp = stamp;
    this.year = year;
    this.agent = agent;
    }

    //getters and setters
    common developed String getName() {
    return indicate;
    }

    common developed useless setName(String indicate) {
    this.indicate = indicate;
    }

    common developed String getType() {
    return stamp;
    }

    common developed useless setType(String stamp) {
    this.stamp = stamp;
    }

    common developed int getYear() {
    return year;
    }

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

    common developed String getBuilder() {
    return agent;
    }

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

    //toString way is used to expose the solution of an motive within it
    @Override
    common String toString() {
    return indicate + ” is a ” + stamp + ” built by ” + agent + ” in ” + year;
    }

    }

    ______________________

    TestShip.java

    common collocate TestShip {

    common static useless ocean(String[] args) {

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

    //Displaying the Ship collocate motive solution within 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