Assignment2

This commit is contained in:
k0rrluna 2024-11-07 02:46:19 +03:00
parent cb2460ee46
commit 95ebce05ed
4 changed files with 50 additions and 28 deletions

Binary file not shown.

View File

@ -53,4 +53,26 @@ public class Dog {
return 24 + (humanYears - 2) * 5;
}
}
public static void main(String args[]) {
Dog dog1 = new Dog("Luna");
Dog dog2 = new Dog("Max");
Dog dog3 = new Dog("Ashley");
dog1.setAge(3);
dog1.setGender("F");
dog1.setBones(202);
dog2.setAge(4);
dog2.setGender("M");
dog2.setBones(204);
dog3.setAge(5);
dog3.setGender("F");
dog3.setBones(101);
System.out.println("Dog 1 is called " + dog1.getName());
System.out.println("Dog 2 has caught " + dog2.getBones() + " bones so far.");
System.out.println("Dog 3 is " + dog3.dogAgeAsPeopleYears(dog3.getAge()) + " years old in human years.");
System.out.println("Dog 1 gender: "+ dog1.getGender());
}
}

View File

@ -1,4 +1,4 @@
import java.util.*;
import java.util.Scanner;
public class histogram {