Crenox

Dog Program

Jan 29th, 2014
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. package samkough.main;
  2.  
  3. public class Dog
  4. {
  5. public static void main(String args[])
  6. {
  7. DogTestDrive one = new DogTestDrive();
  8. one.size = 70;
  9. DogTestDrive two = new DogTestDrive();
  10. two.size = 8;
  11. DogTestDrive three = new DogTestDrive();
  12. three.size = 35;
  13.  
  14. one.bark();
  15. two.bark();
  16. three.bark();
  17. }
  18. }
  19. ------------------------------------------------------------------------------------------------------------------
  20. package samkough.main;
  21.  
  22. public class DogTestDrive
  23. {
  24. int size;
  25. String name;
  26.  
  27. void bark()
  28. {
  29. if (size > 60)
  30. {
  31. System.out.println("Wooof! Wooof!");
  32. }
  33. else if (size > 14)
  34. {
  35. System.out.println("Ruff! Ruff!");
  36. }
  37. else
  38. {
  39. System.out.println("Yip! Yip!");
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment