import java.time.LocalDate
object Main extends App{
val scores: Seq[Score] = Seq(score1, score2, score3, score4)
println(getDate(scores)(LocalDate.of(2020, 1, 30))("Alice"))
def getDate(scoreSeq: Seq[Score]): Map[LocalDate, Map[String, Int]] = scores.groupMap(score => score.date)(score=>Map(score.name -> (score.english+score.math+score.science)))
}
I would like to implement a function that maps the examination date to a map of student names and the total scores of the three subjects on that date, and if there are multiple scores for the same student on the same date, the function returns the one with the highest total score. However, here is the function
found :scala.collection.immutable.Map[java.time.LocalDate,Seq[scala.collection.immutable.Map[String,Int]]]]
"required: Map[java.time.LocalDate,Map[String,Int]]".
How can I resolve this?
Car, you actually provided aCup. And the compiler is telling you that it wanted aCarand not thisCup.