Advertisement
Nikki12345671

Animals

Mar 25th, 2019
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 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.feet = 4;
  16. Bella.canFly = false ;
  17. Bella.message = "Woof!";
  18.  
  19. Bella.speak();
  20.  
  21.  
  22. Sassy = new Animal();
  23.  
  24. Sassy.type = " Pig";
  25. Sassy.color = "Gray";
  26. Sassy.feet = 4 ;
  27. Sassy.canFly = false;
  28. Sassy.message = "Oink!";
  29.  
  30. Sassy.speak();
  31.  
  32. Stella = new Animal();
  33.  
  34. Stella.type = "Ant";
  35. Stella.color = "Red";
  36. Stella.feet = 6 ;
  37. Stella.canFly = false;
  38. Stella.message = "Chirp!";
  39.  
  40.  
  41. Stella.speak();
  42.  
  43.  
  44. }
  45.  
  46. }
  47.  
  48. class Animal {
  49.  
  50. String type;
  51. String color;
  52. int feet;
  53. boolean canFly;
  54. String message;
  55.  
  56. public void speak() {
  57. System.out.println(message);
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement