What do our clients do?

Report a typo

Write the logClientEvent function inside the Main object that will explicitly accept the name of the event and implicitly accept three arguments: a string with the client's name, age as a number, and an identifier.

This function must print a string in the following form:

s"client: $name, age: $age, id: $id - $event"

The following code must work:

object Main extends App {

  // Your function is here

  implicit val clientName: String = "Max"
  implicit val clientAge: Int = 42
  implicit val id: Long = 4918229L

  logClientEvent("LOGIN")
  logClientEvent("LOGOUT")
}

And here is what it must print:

client: Max, age: 42, id: 4918229 - LOGIN
client: Max, age: 42, id: 4918229 - LOGOUT

Sample Input 1:

Max 42 4918229 LOGIN

Sample Output 1:

client: Max, age: 42, id: 4918229 - LOGIN
Write a program in Scala
object Main {
// write a function here
}

Create a free account to access the full topic