adding the programming in scala code