Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. {
  2.  
  3. // fields
  4.  
  5. private short amountOfLegs;
  6. private String favoriteFood;
  7. private String sound;
  8. private String name;
  9.  
  10. //properties
  11. //getter method
  12. public short getAmountOfLegs()
  13. {
  14. return this.amountOfLegs;
  15. }
  16. //setter method
  17. public void setAmountOfLegs(short amountOfLegs)
  18. {
  19. this.amountOfLegs = amountOfLegs;
  20. }
  21.  
  22. public String getFavoriteFood()
  23. {
  24. return this.favoriteFood;
  25. }
  26. public void setFavoriteFood(String favoriteFood)
  27. {
  28. this.favoriteFood = favoriteFood;
  29. }
  30. public String getSound()
  31. {
  32. return this.sound;
  33. }
  34. public void setSound(String sound)
  35. {
  36. this.sound = sound;
  37. }
  38.  
  39. //constructor
  40. public Zoogdier()
  41. {
  42. this.amountOfLegs = 4;
  43. this.favoriteFood = "Banaan";
  44. this.sound = "OehOehAah";
  45. }
  46. public Zoogdier(short amountOfLegs, String favoriteFood, String sound)
  47. {
  48. this.amountOfLegs = amountOfLegs;
  49. this.favoriteFood = favoriteFood;
  50. this.sound = sound;
  51. }
  52.  
  53. //methods
  54. public void(show)()
  55. {
  56. System.out.println("\r\n+++++++++++++++++++++++++++++++++++++++++++++++" +
  57. "Het aantal benen van dit dier bedraagt: " +this.amountOfLegs + "\r\n" +
  58. "Het lievelingeten van dit dier is: " +this.favoriteFood + "\r\n" +
  59. "Het Geluid van dit die is: " + this.sound + "\r\n" +
  60. "+++++++++++++++++++++++++++++++++++++++++++++");
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement