diff --git a/lab2.java b/lab2.java deleted file mode 100644 index 95d032a..0000000 --- a/lab2.java +++ /dev/null @@ -1,53 +0,0 @@ -enum FurLength { none, short, medium, long } - -extension FurLengthPrint on FurLength { - String prints() { - switch (this) { - case FurLength.none: - return ('нет шерсти'); - case FurLength.short: - return('короткая'); - case FurLength.medium: - return('средняя'); - case FurLength.long: - return('длинная'); - default: - return ('нет данных'); - } - } -} - -class Cat { - final String _name; - final int _lifeSpan; - final FurLength _furLength; - - String get name => _name; - int get lifeSpan => _lifeSpan; - String get furLength => _furLength.prints(); - - Cat(this._name, this._lifeSpan, this._furLength); -} - -void main() { - print("Энкциклопедия кошек загружена"); - - final listCats = [ - new Cat("Сфинкс", 13, FurLength.none), - new Cat("Персидская", 20, FurLength.long), - new Cat("Сиамская", 23, FurLength.short), - ]; - - for (final cat in listCats) - { - print("Порода: ${cat.name} \t Продолжительность жизни: ${cat.lifeSpan-3}-${cat.lifeSpan} \t Длина шерсти: ${cat.furLength})"); - } - - Future future = Future.delayed( - Duration(seconds: 1), - () => print("Сохранение данных")); - - future.then((_) { - print("Закрытие приложения"); - }); -} \ No newline at end of file