-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHorse.java
56 lines (50 loc) · 1.31 KB
/
Horse.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//package pl.krakow.up.s138049;
public class Horse {
private String name;
private String breed;
private int age;
private float price;
private int birthDay;
@Override
public String toString() {
return "Hours(name: " + name + ", breed: " + breed + ", age: " + age + ", price: " + price + " EUR, year: " + birthDay + ")";
}
public Horse(String name, String breed, int age, float price) {
this.name = name;
this.breed = breed;
this.age = age;
this.price = price;
this.birthDay = 2019 - this.age;
}
public void setHorseName(String name) {
this.name = name;
}
public void setHorseBreed(String breed) {
this.breed = breed;
}
public void setHorseAge(int age) {
this.age = age;
}
public void setHorsePrice(float price) {
this.price = price;
}
@Override
public Horse clone() throws CloneNotSupportedException {
return (Horse) super.clone();
}
public String getHorseName() {
return this.name;
}
public String getHorseBreed() {
return this.breed;
}
public float getHorsePrice() {
return this.price;
}
public int getHorseAge() {
return this.age;
}
public int getHorseYear() {
return 2019 - age;
}
}