Skip to content

Commit

Permalink
Fixing need-for-speed inconsistencies in the documentation/hints (#…
Browse files Browse the repository at this point in the history
…2738)

* Fixing inconsistencies in the instructions and hints for the need-for-speed exercise

* Removing redundant hint
  • Loading branch information
manumafe98 authored Feb 28, 2024
1 parent 63fa3ba commit 6e697e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions exercises/concept/need-for-speed/.docs/hints.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@

## 6. Check if a remote control car can finish a race

- Solving this is probably best done by [repeatedly driving the car][while].
- Try applying a formula that compares the distance and speed against the battery and battery drain.
- Remember that the car has a method to retrieve the distance it has driven.
- Consider what to do when the battery has been drained before reaching the finish line.

[constructor-syntax]: https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html
[instance-constructors]: https://docs.oracle.com/javase/tutorial/java/javaOO/objectcreation.html
[while]: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/while.html
[fields]: https://docs.oracle.com/javase/tutorial/java/javaOO/variables.html
3 changes: 2 additions & 1 deletion exercises/concept/need-for-speed/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ car.distanceDriven();

## 6. Check if a remote control car can finish a race

To finish a race, a car has to be able to drive the race's distance. This means not draining its battery before having crossed the finish line. Implement the `RaceTrack.tryFinishTrack()` method that takes a `NeedForSpeed` instance as its parameter and returns `true` if the car can finish the race; otherwise, return `false`. To see if the car can finish the race, you should try to drive the car until either you reach the end of the track or the battery drains:
To finish a race, a car has to be able to drive the race's distance. This means not draining its battery before having crossed the finish line. Implement the `RaceTrack.tryFinishTrack()` method that takes a `NeedForSpeed` instance as its parameter and returns `true` if the car can finish the race; otherwise, return `false`:

```java
int speed = 5;
Expand All @@ -88,3 +88,4 @@ race.tryFinishTrack(car);

car.distanceDriven()
// => 100
```

0 comments on commit 6e697e4

Please sign in to comment.