Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.99 KB | None | 0 0
  1. class Cage
  2. {
  3. private int Length;
  4. private int Width;
  5. private int Height;
  6. private boolean Clean;
  7. private boolean Covered;
  8.  
  9. public Cage()
  10. {
  11. Length = 10;
  12. Width = 10;
  13. Height = 10;
  14. Clean = true;
  15. Covered = false;
  16. }
  17.  
  18. public void setLength(int Lenght)
  19. {
  20. this.Length = Length;
  21. }
  22.  
  23. public void setWidth(int Width)
  24. {
  25. this.Width = Width;
  26. }
  27.  
  28. public void setHeight(int Height)
  29. {
  30. this.Height = Height;
  31. }
  32.  
  33. public void setClean(boolean Clean)
  34. {
  35. this.Clean = Clean;
  36. }
  37.  
  38. public void setCovered(boolean Covered)
  39. {
  40. this.Covered = Covered;
  41. }
  42.  
  43. public int getLength()
  44. {
  45. return this.Length;
  46. }
  47.  
  48. public int getWidth()
  49. {
  50. return this.Width;
  51. }
  52.  
  53. public int getHeight()
  54. {
  55. return this.Height;
  56. }
  57.  
  58. public boolean isClean()
  59. {
  60. return this.Clean;
  61. }
  62.  
  63. public boolean isCovered()
  64. {
  65. return this.Covered;
  66. }
  67. }
  68.  
  69.  
  70. class ZooAnimal
  71. {
  72. private String AName;
  73. private String Type;
  74. private int Age;
  75. private boolean Hungry;
  76.  
  77. public ZooAnimal()
  78. {
  79. AName = " ";
  80. Type = " ";
  81. Age = 0;
  82. Hungry = false;
  83. }
  84.  
  85. public void setName(String AName)
  86. {
  87. this.AName = AName;
  88. }
  89.  
  90. public void setType(String Type)
  91. {
  92. this.Type = Type;
  93. }
  94.  
  95. public void setAge(int Age)
  96. {
  97. this.Age = Age;
  98. }
  99.  
  100. public void setHungry(boolean Hungry)
  101. {
  102. this.Hungry = Hungry;
  103. }
  104.  
  105. public String getAName()
  106. {
  107. return this.AName;
  108. }
  109.  
  110. public String getType()
  111. {
  112. return this.Type;
  113. }
  114.  
  115. public int getAge()
  116. {
  117. return this.Age;
  118. }
  119.  
  120. public boolean isHungry()
  121. {
  122. return this.Hungry;
  123. }
  124. }
  125.  
  126.  
  127.  
  128. import java.util.*;
  129.  
  130. class JavaZoo
  131. {
  132. public String ZooName = "Java Park n Zoo";
  133.  
  134. public JavaZoo()
  135. {
  136.  
  137. }
  138.  
  139. public String getZooName()
  140. {
  141. return this.ZooName;
  142. }
  143.  
  144. public static void main(String []args)
  145. {
  146. Scanner sc = new Scanner(System.in);
  147.  
  148. ZooAnimal myFirstAnimal = new ZooAnimal();
  149. Cage myFirstCage=new Cage();
  150. ZooKeeper myFirstZooKeeper = new ZooKeeper();
  151.  
  152. System.out.print("Input Animal Name: ");
  153. myFirstAnimal.setName(sc.nextLine());
  154. System.out.print("Input Animal Type: ");
  155. myFirstAnimal.setType(sc.nextLine());
  156. System.out.print("Clean Cage? : ");
  157. myFirstCage.setClean(sc.nextBoolean());
  158. System.out.print("Input Name of Zookeeper: ");
  159. sc.nextLine();
  160. myFirstZooKeeper.setName(sc.nextLine());
  161. System.out.print("ZooKeeper's Title: ");
  162. myFirstZooKeeper.setTitle(sc.nextLine());
  163. System.out.print("Has a Degree? : ");
  164. myFirstZooKeeper.Degree(sc.nextBoolean());
  165.  
  166. System.out.println("\nAnimal");
  167. System.out.println("Animal Name: " + myFirstAnimal.getAName());
  168. System.out.println("Type: " + myFirstAnimal.getType());
  169. System.out.println("Age: " + myFirstAnimal.getAge());
  170. System.out.println("Not Hungry?: " + myFirstAnimal.isHungry());
  171.  
  172. System.out.println("\nCage");
  173. System.out.println("Length: " + myFirstCage.getLength());
  174. System.out.println("Width: " + myFirstCage.getWidth());
  175. System.out.println("Height: " + myFirstCage.getHeight());
  176. System.out.println("Clean Cage? : " + myFirstCage.isClean());
  177. System.out.println("Covered Cage? : " + myFirstCage.isCovered());
  178.  
  179. System.out.println("\nName");
  180. System.out.println("Name: " + myFirstZooKeeper.getName());
  181. System.out.println("Title: " + myFirstZooKeeper.getTitle());
  182. System.out.println("Payrate: " + myFirstZooKeeper.getPayrate());
  183. System.out.println("Degree? : " + myFirstZooKeeper.Degree());
  184. }
  185. }
  186.  
  187.  
  188. class ZooKeeper
  189. {
  190. private String Name;
  191. private String Title;
  192. private double Payrate;
  193. private boolean Degree;
  194.  
  195. public ZooKeeper()
  196. {
  197. Name = " ";
  198. Title = " ";
  199. Payrate = 14.00;
  200. Degree = false;
  201. }
  202.  
  203. public void setName(String Name)
  204. {
  205. this.Name = Name;
  206. }
  207.  
  208. public void setTitle(String Title)
  209. {
  210. this.Title = Title;
  211. }
  212.  
  213. public void setPayrate(double Payrate)
  214. {
  215. this.Payrate = Payrate;
  216. }
  217.  
  218. public void Degree(boolean Degree)
  219. {
  220. this.Degree = Degree;
  221. }
  222.  
  223. public String getName()
  224. {
  225. return this.Name;
  226. }
  227.  
  228. public String getTitle()
  229. {
  230. return this.Title;
  231. }
  232.  
  233. public double getPayrate()
  234. {
  235. return this.Payrate;
  236. }
  237.  
  238. public boolean Degree()
  239. {
  240. return this.Degree;
  241. }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement