Implicit in a companion

Report a typo

We have a centimeter value class in the scope:

class Centimeter(val value: Int)

Add a meter value class so that we can convert a meter to a centimeter without additional code and imports. The following code must work:

val centimeter: Centimeter = Meter(2)
println(centimeter) // Centimeter(200)

Sample Input 1:

2

Sample Output 1:

200
Write a program in Scala 3
class Meter(val value: Int)

???
___

Create a free account to access the full topic