Squashed 'Programming/ProgLab6/' content from commit 3e98b8e
git-subtree-dir: Programming/ProgLab6 git-subtree-split: 3e98b8e205b1a576c861f90028b198d5052a79c3
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user