dgadiraju
6/21/2017 - 6:11 AM

scala-employeecommission.scala

case class EmployeesCommission(first_name: String,
                               last_name: String,
                               salary: Double,
                               commission_pct: Double) {
  override def toString(): String = {
    s"first_name: " + first_name + ";" + "last_name: " + last_name +
      ";" + "commission amount:" + getCommissionAmount()
  }

  def getCommissionAmount(): Any = {
    if(commission_pct == 0.0) {
      "Not eligible"
    } else salary * commission_pct
  }
}