Dog.java 554B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Write a description of class Dog here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class Dog extends Pet
  8. {
  9. // instance variables - replace the example below with your own
  10. String type = "dog";
  11. /**
  12. * Constructor for objects of class Dog
  13. */
  14. public Dog(String name)
  15. {
  16. super.Pet(name);
  17. }
  18. public Dog()
  19. {
  20. super.Pet();
  21. }
  22. public String speak(){
  23. return "Dogs say WOOF";
  24. }
  25. public String getType(){
  26. return this.type;
  27. }
  28. }