Pet.java 542B

123456789101112131415161718192021222324252627282930313233
  1. public class Pet
  2. {
  3. private String name;
  4. private String petType;
  5. public Pet(){
  6. }
  7. public Pet(String petName){
  8. this.name = petName;
  9. }
  10. public void setPetType(String petType){
  11. this.petType = petType;
  12. }
  13. public String getPetType(){
  14. return petType;
  15. }
  16. public void setName(String name){
  17. this.name = name;
  18. }
  19. public String getName(){
  20. return this.name;
  21. }
  22. public String speak(){
  23. return "**Pet screeches in German**";
  24. }
  25. }