Advertisement
Nikki12345671

Animals

Mar 26th, 2019
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. public class program {
  2.  
  3. public static void main(String[] args) {
  4. // Nikki Forehand
  5. // March 25, 2019
  6. int age;
  7. String name;
  8. Animal Bella, Sassy , Stella;
  9.  
  10. Bella = new Animal();
  11.  
  12. Bella.type = "dog";
  13. Bella.color = "White & Black";
  14. Bella.eyes = 2;
  15. Bella.feet = 4;
  16. Bella.canFly = false ;
  17. Bella.canRun = true;
  18. Bella.canHop = true;
  19. Bella.hair = true;
  20. Bella.smell= true ;
  21. Bella.message = "Woof!";
  22.  
  23. Bella.speak();
  24.  
  25.  
  26. Sassy = new Animal();
  27.  
  28. Sassy.type = " Pig";
  29. Sassy.color = "Gray";
  30. Sassy.eyes = 2;
  31. Sassy.feet = 4 ;
  32. Sassy.canFly = false;
  33. Sassy.canHop = true;
  34. Sassy.canRun = true;
  35. Sassy.hair = false;
  36. Sassy.smell = false ;
  37. Sassy.message = "Oink!";
  38.  
  39. Sassy.speak();
  40.  
  41. Stella = new Animal();
  42.  
  43. Stella.type = "Ant";
  44. Stella.color = "Red";
  45. Stella.eyes = 3;
  46. Stella.feet = 6 ;
  47. Stella.canFly = false;
  48. Stella.canHop = false;
  49. Stella.canRun = true;
  50. Stella.hair = false;
  51. Stella.smell = false;
  52. Stella.message = "Chirp!";
  53.  
  54.  
  55. Stella.speak();
  56.  
  57.  
  58. }
  59.  
  60. }
  61.  
  62. class Animal {
  63.  
  64. String type;
  65. String color;
  66. int feet;
  67. int eyes;
  68. boolean canFly;
  69. boolean canHop;
  70. boolean canRun;
  71. boolean hair;
  72. boolean smell;
  73. String message;
  74.  
  75. public void speak() {
  76. System.out.println(message);
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement