OOP_IO-2x_2023-mirror/Java/lab_6/main.kt

43 lines
1.7 KiB
Kotlin
Raw Normal View History

2023-06-07 15:37:53 +03:00
package OOP.Java.lab_6
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
fun main() {
2023-06-10 20:47:59 +03:00
2023-06-07 15:37:53 +03:00
val chromatica = Album(
"Chromatica",
"Lady Gaga",
arrayOf(
Interlude(1, "Chromatica I", null, 1.minutes),
2023-06-10 20:47:59 +03:00
Synthpop(2, "Alice", null, 2.minutes + 57.seconds),
Dancepop(3, "Stupid Love", null, 3.minutes + 13.seconds),
Dancepop(4, "Rain On Me", "Ariana Grande", 3.minutes + 2.seconds),
Synthpop(5, "Free Woman", null, 3.minutes + 11.seconds),
Electropop(6, "Fun Tonight", null, 2.minutes + 53.seconds),
2023-06-07 15:37:53 +03:00
Interlude(7, "Chromatica II", null, 41.seconds),
2023-06-10 20:47:59 +03:00
Synthpop(8, "911", null, 2.minutes + 52.seconds),
Electropop(9, "Plastic Doll", null, 3.minutes + 41.seconds),
Dancepop(10, "Sour Candy", "Blackpink", 2.minutes + 37.seconds),
Dancepop(11, "Enigma", null, 2.minutes + 59.seconds),
Synthpop(12, "Replay", null, 3.minutes + 6.seconds),
2023-06-07 15:37:53 +03:00
Interlude(13, "Chromatica III", null, 27.seconds),
2023-06-10 20:47:59 +03:00
Electropop(14, "Sine From Above", "Elton John", 4.minutes + 4.seconds),
Synthpop(15, "1000 Doves", null, 3.minutes + 35.seconds),
Dancepop(16, "Babylon", null, 2.minutes + 41.seconds)
2023-06-07 15:37:53 +03:00
)
)
println("$chromatica\n")
2023-06-08 13:47:22 +03:00
println("${chromatica.albumName} tracks sorted by musical style:\n${chromatica.tracks.sortedBy { it.style }.joinToString("\n")}\n")
2023-06-07 15:37:53 +03:00
val durationRange = 1.minutes.. 3.minutes + 30.seconds
println(
"${chromatica.albumName} tracks in a duration range ($durationRange):\n${chromatica.tracksInDurationRange(durationRange).joinToString("\n")}"
)
}