Practice 34174

Report a typo

Let's go to a store to buy some ice-cream. While walking, we can daydream, and, in a way, we can count this time as waiting time. We've declared a function to simulate that. Standing in the queue also qualifies as waiting time. We have another function for that.

In this task, call the walk function two times: first to go to the shop 352 meters away and then to go to a park 120 meters away, where you will eat the ice-cream. Between those calls, invoke the waitInQueue function.

For this task, assume that we're walking at a constant speed of 1 meter per second.

Write a program in Kotlin
suspend fun walk(meters: Double) {
println("Walking $meters meters. Feel free to dream about something!")
delaySeconds(meters.toLong())
}

suspend fun waitInQueue() {
println("Staying in the queue. Feel free to dream about something!")
waitForTurn()
}

// Please change only the "main" function:
fun main() {

}
___

Create a free account to access the full topic