forked from Klagarge/MSE-AdvProg-MicroProject
		
	fix: feedback ex3
This commit is contained in:
		| @@ -83,26 +83,22 @@ case class TopSongs(songs: List[Song] = List()) { | |||||||
|     TopSongs(song :: songs) |     TopSongs(song :: songs) | ||||||
|   } |   } | ||||||
|   def printSongs(): Unit = { |   def printSongs(): Unit = { | ||||||
|     songs.foreach(song => { |     songs.map(song => { | ||||||
|       val title = song.title |       val title = song.title | ||||||
|       val singer = song.singer |       val singer = song.singer | ||||||
|       val producers = song.producer.map(_.create()).mkString(", ") |       val producers = song.producer.map(_.create()).mkString(", ") | ||||||
|       val streak = song.rank._1.streak.getOrElse("no") |       val streak = song.rank._1.streak.getOrElse("no") | ||||||
|       val pos = song.rank._2.pos.getOrElse("NA") |       val pos = song.rank._2.pos.getOrElse("NA") | ||||||
|  |  | ||||||
|       if (singer.exists(a => { |       singer match { | ||||||
|         a.isInstanceOf[God] |         case s if s.exists(_.person.isInstanceOf[God]) => println(s"$title by God ${singer.map(_.person.name).mkString(", ")} spent $streak weeks on the charts on Pos. $pos") | ||||||
|       })) { |         case _ => println( | ||||||
|         println(s"$title by God ${singer.map(_.person.name).mkString(", ")} spent $streak weeks on the charts on Pos. $pos") |  | ||||||
|       } else { |  | ||||||
|         println( |  | ||||||
|           s"$title by ${singer.map(_.person.name).mkString(", ")}. " + |           s"$title by ${singer.map(_.person.name).mkString(", ")}. " + | ||||||
|             s"$producers this song that " + |             s"$producers this song that " + | ||||||
|             s"spent $streak weeks " + |             s"spent $streak weeks " + | ||||||
|             s"on the charts on Pos. $pos" |             s"on the charts on Pos. $pos" | ||||||
|         ) |         ) | ||||||
|       } |       } | ||||||
|  |  | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user