Advertisement
Nikki12345671

Animals

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