Last active
April 24, 2020 15:02
-
-
Save jonnycaley/a7d258a799e8c94b12132d54b34dbcb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun calculateCost(vehicle: Vehicle): Money { | |
return when (vehicle) { | |
is CAR -> { | |
CalculateCarCost(vehicle) | |
} | |
is MOTORBIKE -> { | |
CalculateMotorbikeCost(vehicle) | |
} | |
is VAN -> { | |
CalculateVanCost(vehicle) | |
} | |
is LORRY -> { | |
CalculateLorryCost(vehicle) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment