<In what way does your code behave incorrectly? Include ALL error messages.>
I’ve looked through the errors and there seems to be something wrong with checkBatteryLevel and my hover method.
I have no idea why my main isn’t working.
```
public class Droid {
public int batteryLevel;
public void Droid(){
batteryLevel = 100;
}
public void activate () {
System.out.println("Activated. How can I help you?");
batteryLevel = batteryLevel - 5;
System.out.println("Battery level is: " + batteryLevel);
}
public void chargeBattery (int hours) {
System.out.println("Droid charging...");
batteryLevel = batteryLevel + hours;
if (batteryLevel > 100){
System.out.println("Battery level is:" + batteryLevel + " .");
}else{
System.out.println("Battery level is:" + batteryLevel + " .");
}
public int checkBatteryLevel ()
{
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("Battery level is: " + batteryLevel +" .");
}
}
public static void main(String [ ] args)
{
Droid droid = new Droid();
droid.activate();
droid.chargeBattery(5);
droid.hover(1);
}
}
//Errors
Droid.java:19: error: illegal start of expression
public int checkBatteryLevel ()
^
Droid.java:19: error: ';' expected
public int checkBatteryLevel ()
^
Droid.java:23: error: illegal start of expression
public void hover(int feet){
^
Droid.java:23: error: illegal start of expression
public void hover(int feet){
^
Droid.java:23: error: ';' expected
public void hover(int feet){
^
Droid.java:23: error: ';' expected
public void hover(int feet){
^
Droid.java:35: error: illegal start of expression
public static void main(String [ ] args)
^
Droid.java:35: error: illegal start of expression
public static void main(String [ ] args)
^
Droid.java:35: error: ';' expected
public static void main(String [ ] args)
^
Droid.java:35: error: '.class' expected
public static void main(String [ ] args)
^
Droid.java:35: error: ';' expected
public static void main(String [ ] args)
^
Droid.java:42: error: reached end of file while parsing
}
^
12 errors
You’ll find the issue if you clean up the formatting, specifically indentation/braces
(I suggest keeping that tidy at all times so that you can see what’s what)