Skip to content

Commit

Permalink
Add clarification to the Factory Method task
Browse files Browse the repository at this point in the history
  • Loading branch information
onewhl committed Nov 7, 2023
1 parent 53bbf58 commit 57299ab
Showing 1 changed file with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,8 @@ Please, create a new class named `TransportationServiceFactory` and implement `g

<div class="hint" title="How should TransportationServiceFactory class look?">

Here's the `TransportationServiceFactory` code:

```kotlin
class TransportationServiceFactory {
fun getTransportation(transport: String): Transport {
return when (transport) {
"car" -> Car()
"bicycle" -> Bicycle()
else -> throw IllegalArgumentException("Unknown transport")
}
}
}
```
Examine the code in the `main` method to identify the lines that create specific transports based on their names.
Then, move those lines manually to the `getTransportation(transport: String)` method in the `TransportationServiceFactory` class.

</div>

Expand Down

0 comments on commit 57299ab

Please sign in to comment.