Question: how to combine these three robot class into one class Some things to note: 1. In Robot.java , we want all of the constructors from

how to combine these three robot class into one class

how to combine these three robot class into one class Some things

to note: 1. In Robot.java , we want all of the constructors

from before there are 3). 2. The underlying behaviour should be the

same. l.e. every instance of the Robot class should have a speak(),

friendSpeak() , makeFriend() method as before 3. After you complete the Robot

Some things to note: 1. In Robot.java , we want all of the constructors from before there are 3). 2. The underlying behaviour should be the same. l.e. every instance of the Robot class should have a speak(), friendSpeak() , makeFriend() method as before 3. After you complete the Robot class, make three Robots in Main.java and make them all friends as in 4.2. 4. Finally, print out the complete verse as in 4.2. You can use the supplied lines in Main.java as those are the lines expected as the output for this task. Your code should do exactly the same thing as before. public class Robot { A5 24v private String name; private Robot friend = null; // name of Robot // this Robot's frie // lines this Robot knows private String line = "You ain't nothin' but a hound dog, cryin' } public class Robotone { A7X2 private String name // name of RobotOne // lines Robotone knows private String line = "You ain't nothin' but a hound dog, cryin' private RobotThree friend = null; // Robotone's frie /** * Constructor for RobotOne, takes the name, default values are */ public RobotOne(String name) { this.name = name; } /** * Give Robotone a friend. */ public void makeNewFriend (RobotThree robotThree) { friend = robo /** * Get Robotone to say something it knows. */ public String speak() { return line; } } lic class RobotTwo { A7 A private String name; // name of Robot Two // lines RobotTwo knows private String line = "Well, you ain't never caught no rabbit and private Robotone friend = null; // RobotTwo's friend /** * Constructor for RobotTwo, takes the name, default values are al */ public RobotTwo (String name) { this.name = name; } /** * Give RobotTwo a friend. */ public void makeFriend (RobotOne robotone) { friend = robotone; } /** * Get Robot Two to say something it knows. */ public String speak() { return line; } lic class RobotThree { A7 A private String name; // name of RobotThree // lines RobotThree knows private String Line = "Ah thank you, ah thank you very much"; private Robot Two friend = null; // RobotThree's friend /** * Constructor for RobotThree, takes the name, default values are */ public RobotThree(String name) { this.name = name; } /** * Give RobotThree a friend. */ public void makeFriend(RobotTwo robotTwo) { friend = robotTwo; } /** * Get RobotThree to say something it knows. */ public String speak() { return line; } Some things to note: 1. In Robot.java , we want all of the constructors from before there are 3). 2. The underlying behaviour should be the same. l.e. every instance of the Robot class should have a speak(), friendSpeak() , makeFriend() method as before 3. After you complete the Robot class, make three Robots in Main.java and make them all friends as in 4.2. 4. Finally, print out the complete verse as in 4.2. You can use the supplied lines in Main.java as those are the lines expected as the output for this task. Your code should do exactly the same thing as before. public class Robot { A5 24v private String name; private Robot friend = null; // name of Robot // this Robot's frie // lines this Robot knows private String line = "You ain't nothin' but a hound dog, cryin' } public class Robotone { A7X2 private String name // name of RobotOne // lines Robotone knows private String line = "You ain't nothin' but a hound dog, cryin' private RobotThree friend = null; // Robotone's frie /** * Constructor for RobotOne, takes the name, default values are */ public RobotOne(String name) { this.name = name; } /** * Give Robotone a friend. */ public void makeNewFriend (RobotThree robotThree) { friend = robo /** * Get Robotone to say something it knows. */ public String speak() { return line; } } lic class RobotTwo { A7 A private String name; // name of Robot Two // lines RobotTwo knows private String line = "Well, you ain't never caught no rabbit and private Robotone friend = null; // RobotTwo's friend /** * Constructor for RobotTwo, takes the name, default values are al */ public RobotTwo (String name) { this.name = name; } /** * Give RobotTwo a friend. */ public void makeFriend (RobotOne robotone) { friend = robotone; } /** * Get Robot Two to say something it knows. */ public String speak() { return line; } lic class RobotThree { A7 A private String name; // name of RobotThree // lines RobotThree knows private String Line = "Ah thank you, ah thank you very much"; private Robot Two friend = null; // RobotThree's friend /** * Constructor for RobotThree, takes the name, default values are */ public RobotThree(String name) { this.name = name; } /** * Give RobotThree a friend. */ public void makeFriend(RobotTwo robotTwo) { friend = robotTwo; } /** * Get RobotThree to say something it knows. */ public String speak() { return line; }

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