Write a function that simulates an alarm clock. Initially, the function prints It's time to get up!, after one second the function should print You overslept by <TIME> seconds, it's time to get up! every second, where TIME is incremented every second.
Executors
Alarm clock
Report a typo
Sample Input 1:
Sample Output 1:
It's time to get up!
You overslept by 1 seconds, it's time to get up!
You overslept by 2 seconds, it's time to get up!
You overslept by 3 seconds, it's time to get up!
You overslept by 4 seconds, it's time to get up!
You overslept by 5 seconds, it's time to get up!Write a program in Kotlin
import java.util.concurrent.*
// do not change this code
val executor: ScheduledExecutorService = Executors.newSingleThreadScheduledExecutor()
fun alarm() {
// write here
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.