Generating custom notification message for user

Report a typo

Write a program in Kotlin which takes a user's name as input and a number. The program should print a custom message for that user. The message must be: 'Hello {user}, you have {number} new notifications.'

Sample Input 1:

John
3

Sample Output 1:

Hello John, you have 3 new notifications.

Sample Input 2:

Lucy
0

Sample Output 2:

Hello Lucy, you have 0 new notifications.
Write a program in Kotlin
// Necessary import statement
import java.util.*

fun main(args: Array<String>) {
// Create a Scanner object for taking input
val reader = Scanner(System.`in`)

// Get user name
val userName = reader.nextLine()

// Get number
val num = reader.nextInt()

// Make sure to use string templates to format your message
// YOUR CODE GOES HERE
}

Create a free account to access the full topic