John and Nick have their own rooms. You need to write type aliases named johnArea and nickArea to get the area of their rooms and return the total area of the rooms in function findTotalArea(). It is known that the area of John's room is 40 and the area of Nick's room is 60.
Type aliases
Application
Report a typo
Write a program in Kotlin
class John {
class JohnApartment(sizeOfRoom: Int) {
val size: Int = sizeOfRoom
}
}
class Nick {
class NickApartment(sizeOfRoom: Int) {
val size: Int = sizeOfRoom
}
}
fun findTotalArea(): Int {
// return the total area
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.