Assignment 1 Java 2 International class
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.1 KiB

  1. import java.util.*;
  2. public class Dog extends Pet {
  3. private String breed;
  4. public Dog(){
  5. super();
  6. this.breed = "";
  7. }
  8. public Dog(int petId, String name, double weight, Date dob, double accumulatedDose, String breed){
  9. super(petId, name, weight, dob, accumulatedDose);
  10. this.breed = breed;
  11. }
  12. //Setter
  13. public void setBreed(String breed){
  14. this.breed = breed;
  15. }
  16. //Getter
  17. public String getBreed(){
  18. return this.breed;
  19. }
  20. public double getDose(){
  21. if (getAccumulatedDose() > 750){
  22. return 0;
  23. // }else if( findAge() < 3){
  24. // return 0;
  25. // }else if(findAge() > 12 && getWeight() <2){
  26. // return 6 + 0.75 * getWeight();
  27. }else{
  28. return 12 + 0.65* getWeight();
  29. }
  30. }
  31. public String toString(){
  32. return "petID=" + getPetId() +
  33. ", name='" + getName() + '\'' +
  34. ", weight=" + getWeight() +
  35. // ", dob=" + VetClinicConsole.dateToStr(getDob()) +
  36. // ", accumulatedDose=" + getAccumulatedDose() +
  37. ",breed='" + breed + '\'';
  38. }
  39. }