diff --git a/README.md b/README.md index 6eb8bba..d85e189 100644 --- a/README.md +++ b/README.md @@ -72,3 +72,5 @@ * `Integer getNumberOfPets()` * `String getName()` * `Pet[] getPets()` + +hello \ No newline at end of file diff --git a/src/main/java/com/zipcodewilmington/assessment1/Cat.java b/src/main/java/com/zipcodewilmington/assessment1/Cat.java index 1cf2894..6d9cbcd 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/Cat.java +++ b/src/main/java/com/zipcodewilmington/assessment1/Cat.java @@ -10,6 +10,7 @@ public class Cat extends Pet { */ public Cat(String name, Integer age) { + } /** diff --git a/src/main/java/com/zipcodewilmington/assessment1/Pet.java b/src/main/java/com/zipcodewilmington/assessment1/Pet.java index afc3e99..220f592 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/Pet.java +++ b/src/main/java/com/zipcodewilmington/assessment1/Pet.java @@ -8,6 +8,10 @@ public abstract class Pet implements Animal { * nullary constructor * by default, pet has age of 0; name of ""; */ + private String name; + private Integer age; + private PetOwner owner; + public Pet() { } @@ -15,6 +19,7 @@ public Pet() { * @param name name of this pet */ public Pet(String name) { + this.name=""; } @@ -22,6 +27,7 @@ public Pet(String name) { * @param age age of this pet */ public Pet(int age) { + this.age=0; } /** @@ -29,20 +35,23 @@ public Pet(int age) { * @param age age of this pet */ public Pet(String name, int age) { + this.name=""; + this.age=0; } /** * @return name of this pet */ public String getName() { - return null; + + return name; } /** * @return age of this pet */ public Integer getAge() { - return null; + return age; } /** @@ -50,12 +59,16 @@ public Integer getAge() { * ensure this instance of `Pet` is added to the owner's composite `pets` list */ public void setOwner(PetOwner newPetOwner) { + + this.owner = newPetOwner; + newPetOwner.addPet(this); + } /** * @return PetOwner object whose composite `pets` collection contains this Pet instance */ public PetOwner getOwner() { - return null; + return owner; } } diff --git a/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java b/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java index 326ada5..f49844f 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java +++ b/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java @@ -8,7 +8,11 @@ public class PetOwner { * @param name name of the owner of the Pet * @param pets array of Pet object */ - public PetOwner(String name, Pet... pets) { + + public PetOwner(String name, Pet... pets) + { + + } /**