33 lines
739 B
Java
33 lines
739 B
Java
package ru.gb.jcore;
|
|
|
|
public class Cat {
|
|
private static final int CURRENT_YEAR = 2022;
|
|
private static int id = 0;
|
|
|
|
private String name;
|
|
private String color;
|
|
private int birthYear;
|
|
public int uid;
|
|
|
|
Cat (String name, String color, int age) {
|
|
setBirth(age);
|
|
this.name = name;
|
|
this.color = color;
|
|
this.uid = ++id;
|
|
}
|
|
private void setBirth(int age) {
|
|
this.birthYear = CURRENT_YEAR - age;
|
|
}
|
|
public int getUid() {
|
|
return uid;
|
|
}
|
|
public String getColor() {
|
|
return color;
|
|
}
|
|
public int getAge() {
|
|
return CURRENT_YEAR - birthYear;
|
|
}
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
} |