java-exercism-exercises/elons-toy-car/HINTS.md

1.2 KiB

Hints

General

1. Buy a brand-new remote controlled car

2. Display the distance driven

  • Keep track of the distance driven in a field.
  • Consider what visibility to use for the field (does it need to be used outside the class?).

3. Display the battery percentage

  • Keep track of the distance driven in a field.
  • Initialize the field to a specific value to correspond to the initial battery charge.
  • Consider what visibility to use for the field (does it need to be used outside the class?).

4. Update the number of meters driven when driving

  • Update the field representing the distance driven.

5. Update the battery percentage when driving

  • Update the field representing the battery percentage driven.

6. Prevent driving when the battery is drained

  • Add a conditional to only update the distance and battery if the battery is not already drained.
  • Add a conditional to display the empty battery message if the battery is drained.