Guest User

Untitled

a guest
May 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. package gameoflife;
  2. import java.util.Random;
  3.  
  4.  
  5. public abstract class Animal {
  6.  
  7. public enum Gender {
  8. FEMALE, MALE
  9. }
  10.  
  11. public Gender gender;
  12. public int age;
  13.  
  14. public String name;
  15. public String status;
  16.  
  17.  
  18. public Animal() {
  19. }
  20. public Animal(int age, Gender gender) {
  21. System.out.println("A new animal has been created with an age");
  22. }
  23.  
  24. public void sleep() {
  25. System.out.println("An animal sleeps...");
  26. }
  27.  
  28. public void eat() {
  29. System.out.println("An animal eats...");
  30. }
  31. //
  32. public String toString() {
  33. return name;
  34.  
  35. };
  36.  
  37. public int getAge() {
  38. return age;
  39. }
  40. }
Add Comment
Please, Sign In to add comment