1d57fb83a4
git-subtree-dir: Programming/ProgLab6 git-subtree-split: 3e98b8e205b1a576c861f90028b198d5052a79c3
24 lines
634 B
Kotlin
24 lines
634 B
Kotlin
package elements
|
|
|
|
import exceptions.InvalidElementValueException
|
|
import kotlinx.serialization.Serializable
|
|
|
|
/**
|
|
* Человек для города [City].
|
|
*
|
|
* @param name
|
|
* @param age
|
|
* @param height
|
|
*/
|
|
@Serializable
|
|
class Human(private val name: String, private val age: Long, private val height: Float) {
|
|
init{
|
|
if (name == "") throw InvalidElementValueException(name)
|
|
if (age <= 0) throw InvalidElementValueException(age)
|
|
if (height <= 0) throw InvalidElementValueException(height)
|
|
}
|
|
|
|
override fun toString(): String {
|
|
return "$name, возраст $age, рост $height"
|
|
}
|
|
} |