27 lines
576 B
Dart
27 lines
576 B
Dart
class Student {
|
|
String name;
|
|
int age;
|
|
List<String> courses;
|
|
final String? image;
|
|
|
|
Student(this.name, this.age, this.courses, {this.image});
|
|
|
|
static String getYearWord(int age) {
|
|
if (age == -1) {
|
|
return "Undefined";
|
|
}
|
|
if (age % 10 == 1) {
|
|
return age.toString() + " год";
|
|
} else if (age % 10 < 5 && age % 10 != 0) {
|
|
return age.toString() + " года";
|
|
} else {
|
|
return age.toString() + " лет";
|
|
}
|
|
}
|
|
|
|
void displayInfo() {
|
|
print('Name: $name, Age: $age');
|
|
print('Courses: ${courses.join(", ")}');
|
|
}
|
|
}
|