Answer to Question #246488 in Java | JSP | JSF for jersonjangerona

Question #246488
We’ve set up a robot workshop to build some droids. All that’s missing are the instructions on how to create the robots and what they’ll do.
Can we write a Java class to help?

String droidName
droidName
name
battery level
performing a task
stating its battery level
codey.performTask("dancing")
1
Expert's answer
2021-10-04T19:59:04-0400
public class Robot {
    private String droidName;
    private int batteryLevel;

    public Robot(String name) {
        droidName = name;
        batteryLevel = 100;
    }

    public void performTask(String task) {
        System.out.println("Performing task: " + task);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS