Build a Droid - Task 13

Hi there,

Looking for some help if possible.
Almost completed the Build a Droid lesson but stuck on Task 13:

Create new instances and play around with methods. Here are some ideas to get you started:
** Create a energyReport() method that prints the instance’s batteryLevel.*
** Create another instance.*
** Create a method energyTransfer() that exchanges batteryLevel between instances.*

No matter how much I play around, unable to find solution and progress is blocked as the “Next” button is greyed out until I work it out!
I also ran through the video but it fails to offer a solution (Handily, it leaves Task 13 out).

My up to date code is below, just missing the solution to the final part, Task 13.
I’m a newbie so struggling with this.
Thanks in advance!


public class Droid{

int batteryLevel;
String name;

public Droid(String droidName){
name = droidName;
int batteryLevel = 100;

}

public String toString(){
return "Hello, I am the droid: " + name + “!”;
}

public void performTask(String task){
batteryLevel = batteryLevel -10;
System.out.println(name + " is performing task: " + task);
//System.out.println(batteryLevel);

}

public static void main(String args) {
Droid codey = new Droid(“Codey”);
System.out.println(codey);
codey.performTask(“dancing”);
codey.performTask(“coding”);
}
}


In the exercises, the green check-marks appear after code execution if your code meets the specs of the step successfully.

But usually for the projects, you have to manually check off the steps yourself. As you complete each step, you should click the checkbox yourself. Once you have manually ticked off all the steps, it should register your project as being completed.

I think there is a walkthrough video which shows step 13: https://www.youtube.com/watch?v=JwTtgDHLISQ

1 Like

Hi mtrtmk,

Thanks for the feedback. You can’t self check this part of the exercise unfortunately.
Also, the walkthrough video covers everything but the final part. The part I need.

Doesn’t the video (https://www.youtube.com/watch?v=JwTtgDHLISQ) work through Step 13 from the 24:39 mark?