What type of method I should use?

Please, help me with determination of types, that I should use in methods activate, chargeBattery and hover, because tasks gives me order that this methods should n’t return a value? So, it’s not int, but with void I have errors.

Thanks everyone for answer.

``` class droid {

int batteryLevel;

public droid() {

int batteryLevel = 100;

}

public void activate() {

System.out.println(“Activated. How can I help you?”);
batteryLevel = batteryLevel - 5;
System.out.println(“Battery level is: " + batteryLevel + " percent.”);
}

public void chargeBattery (int hours) {

System.out.println(“Droid charging…”);
batteryLevel = batteryLevel + (hours*20);

if (batteryLevel >= 100) {
  
  batteryLevel = 100;
  System.out.println("Battery has been charged.");
}

else {
  
  System.out.println(batteryLevel);
}

}

public int checkBatteryLevel (int batteryLevel) {

System.out.println(batteryLevel);
return batteryLevel;
 }

public void hover(int feet) {

if (feet > 2) {
  
  System.out.println("Error! I cannot hover above 2 feet.");
      }

else {
  
 System.out.println("Hovering...");
  batteryLevel = batteryLevel - 20;
  System.out.println(batteryLevel);
     }

}

public static void main(String args) {

droid myDroid = new droid();

System.out.println(myDroid.activate());
System.out.println(myDroid.chargeBattery(2));
System.out.println(myDroid.hover(1));

}

}

<do not remove the three backticks above>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.