Matching on Class Members

def calcType(calc: Calculator) = calc match {
    case _ if calc.brand == "hp" && calc.model == "20B" => "financial"
    case _ if calc.brand == "hp" && calc.model == "48G" => "scientific"
    case _ if calc.brand == "hp" && calc.model == "30G" => "business"
}

Case Class with Pattern Matching

val calc1 = Calculator("hp", "48G")
val calc2 = Calculator("hp", "30G")

def calcType(calc: Calculator) = calc match{
    case Calculator("hp", "20B") => "financial"
    case Calculator("hp", "48G") => "scientific"
    case Calculator("hp", "30G") => "business"
    case Calculator(ourBrand, ourModel) => "Calculator: %s %s is of unknown type".format(ourBrand, ourModel)
}

OR we could re-bind the matched value with another name

case c@Calculator(_, _) => "Calculator: %s of unknown type".format(c)