You have the following snippet of code:
data class Floor(val area: Int, val building: String, val numberOfRooms: Int) {
override fun equals(other: Any?): Boolean {
return other is Floor && building == other.building &&
area == other.area && numberOfRooms == other.numberOfRooms
}
}
Also, you have the following output:
false
true
false
Choose the correct main() functions for the given output:
1) fun main() {
val first = Floor(140, "University", 4)
val second = Floor(140, "University", 4)
val third = Floor(140, "University", 4)
println(first == second)
println(first == third)
println(second == third)
}
2) fun main() {
val first = Floor(140, "University", 4)
val second = Floor(150, "University", 4)
val third = Floor(140, "University", 4)
println(first == second)
println(first == third)
println(second == third)
}
3) fun main() {
val first = Floor(140, "Universyty", 4)
val second = Floor(140, "University", 3)
val third = Floor(140, "Universyty", 4)
println(first == second)
println(first == third)
println(second == third)
}
4) fun main() {
val first = Floor(140, "Unversity", 4)
val second = Floor(140, "Unversity", 4)
val third = Floor(140, "Unversity", 4)
println(first == second)
println(first == third)
println(second == third)
}