Multiply apply

Report a typo

We have a public trait Phone and two implementations. We don't want to disclose the implementations of these models, so we made them private. But we need two methods in order to get a stable model and an experimental one. Implement these methods without revealing hidden data.

Sample Input 1:

Sample Output 1:

X100P20
Y100P42
Write a program in Scala 3
trait Phone:
def serialNumber: String

object Phone:
// Stable
private class PhoneX extends Phone:
val serialNumber: String = "X100P20"

// Experimental
private class PhoneY extends Phone:
val serialNumber: String = "Y100P42"

def getStableModel: Phone = ???
def getExperimentalModel: Phone = ???
___

Create a free account to access the full topic