Skip to content

Instantly share code, notes, and snippets.

@sonumehrotra
Created March 7, 2021 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sonumehrotra/0f0c1a4433629f802c66808797ec8045 to your computer and use it in GitHub Desktop.
Save sonumehrotra/0f0c1a4433629f802c66808797ec8045 to your computer and use it in GitHub Desktop.
import CompanySalaryApplication._
object CompanyBBonus:
given companyBonus: CompanyBonus = CompanyBonus(2000)
object CompanyB extends App with SalaryComputation:
import CompanyBBonus.given
val julie = Employee("Julie", 8000)
val julia = Employee("Julia", 10000)
val employees = List(julie, julia)
val employeeAndSalary = employees.map(emp => emp.name -> computeSalary(emp))
println(s"Map of employee and salary for company B is $employeeAndSalary")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment