Your task is about building your own Robot. Write the full code of the RobotBuilder class, build your robot in the TestDrive class, and get the correct output.
Builder
Robot Builder
Report a typo
Sample Input 1:
4
2
1Sample Output 1:
CPU : Intel Core i5
Legs : 4
Hands : 2
Eyes : 1Write a program in Java 17
import java.util.Scanner;
class Robot {
private String cpu;
private int legs;
private int hands;
private int eyes;
Robot(String cpu, int legs, int hands, int eyes) {
this.cpu = cpu;
this.legs = legs;
this.hands = hands;
this.eyes = eyes;
}
public static class RobotBuilder {
/* write your code here (fields) */
RobotBuilder setCpu(String cpu) {
/* write your code here */
}
RobotBuilder setLegs(int legs) {
/* write your code here */
}
RobotBuilder setHands(int hands) {
/* write your code here */
}
RobotBuilder setEyes(int eyes) {
/* write your code here */
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.