Advertisement
Strike15

Untitled

Mar 13th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. // Thomas Phillips Teacher: Mrs.Regan
  2. // CS2 Animal
  3. public class Program {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. @SuppressWarnings("unused")
  8. int age;
  9. @SuppressWarnings("unused")
  10. String name;
  11. @SuppressWarnings("unused")
  12. Animal Jim , Sally;
  13.  
  14. age = 17;
  15. name = "James";
  16. Animal Jim1 = new Animal();
  17.  
  18. Jim1.type = "Dog";
  19. Jim1.color = "Pink";
  20. Jim1.feet = 4;
  21. Jim1.canFly = false;
  22. Jim1.message = "Woof";
  23.  
  24. Jim1.speak();
  25.  
  26. Sally = new Animal();
  27. Sally.type = "Fox";
  28. Sally.color = "Purple";
  29. Sally.feet = 4;
  30. Sally.canFly = false;
  31. Sally.message = "What does the fox?";
  32.  
  33. Sally.speak();
  34.  
  35. }
  36.  
  37. }
  38. class Animal {
  39. String type;
  40. String color;
  41. int feet;
  42. boolean canFly;
  43. String message;
  44.  
  45. public void speak() {
  46. System.out.println(message);
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement