Java Java Objects Harnessing the Power of Objects Increment and Decrement

Enyang Mercy
PRO
Enyang Mercy
Pro Student 2,339 Points

GoKart Drive lapsDriven variable increment

i'm stuck. Help please

GoKart.java
class GoKart {
  public static final int MAX_BARS = 8;
  private String color;
  private int barCount;
  private int lapsDriven+;

  public GoKart(String color) {
    this.color = color;
  }

  public String getColor() {
    return color;
  }

  public void charge() {
    barCount = MAX_BARS;
  }

  public boolean isBatteryEmpty() {
    return barCount == 0;
  }

  public boolean isFullyCharged() {
    return MAX_BARS == barCount;
  }
  public void drive() {
    lapsDriven+;

  }
}

2 Answers

Daniel Vargas
Daniel Vargas
29,182 Points

Hi,

You missed a plus sign, to add one it should be two.

public void drive() {
    lapsDriven++;

  }