public class Dog
1: public class Dog
2: {
3: public String name;
4: public String breed;
5: public int age;
6:
7: public void writeOutput()
8: {
9: System.out.println("Name: " + name);
10: System.out.println("Breed: " + breed);
11: System.out.println("Age in calendar years: " + age);
12: System.out.println("Age in human years: " + getAgeInHumanYears());
13: System.out.println();
14: }
15:
16: public int getAgeInHumanYears()
17: {
18: int humanYears = 0;
19: if (age <= 2)
20: {
21: humanYears = age * 11;
22: }
23: else
24: {
25: humanYears = 22 + ((age-2) * 5);
26: }
27: return humanYears;
28: }
29: }