Refactoring (part 12)

  • 14
  • Locked
12.1. Combine conditional expressions. 12.1.1. In the Car class, add a private method that indicates whether passengers can be carried: boolean canPassengersBeCarried(). The method should return true if the driver is available (isDriverAvailable) and there is fuel.
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
dnlklnhfr
Level 30 , Karlsruhe, Germany
23 July 2020, 17:26
Dear CodeGym-Team: What is wrong with a ternary-Operator for Requirement #2?
return (canPassengersBeCarried()) ? numberOfPassengers : 0;
The validator rejected this super simple solution.