Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package animals;
  2.  
  3. public class Goat
  4. {
  5. private static String name;
  6. private static String color;
  7. private static int legs;
  8. private static boolean tail;
  9. private static String travel;
  10. private static String sound;
  11.  
  12. public static String setName()
  13. {
  14. name = "Billy";
  15. return name;
  16. }
  17. public static String setColor()
  18. {
  19. color = "White";
  20. return color;
  21. }
  22. public static int setLegs()
  23. {
  24. legs = 4;
  25. return legs;
  26. }
  27. public static boolean setTail()
  28. {
  29. tail = true;
  30. return tail;
  31. }
  32. public static String setTravel()
  33. {
  34. travel = "Walk";
  35. return travel;
  36. }
  37. public static String setSound()
  38. {
  39. sound = "Bleat";
  40. return sound;
  41. }
  42.  
  43. public void writeOutput()
  44. {
  45. setName();
  46. setColor();
  47. setLegs();
  48. setTail();
  49. setTravel();
  50. setSound();
  51. System.out.println("Name: " + name);
  52. System.out.println("Color: " + color);
  53. System.out.println("How many legs: " + legs);
  54. System.out.println("Tail? " + tail);
  55. System.out.println("Locomotion Method: " + travel);
  56. System.out.println("Sound Made: " + sound);
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement