diff --git a/src/main/java/com/zipcodewilmington/assessment1/Cat.java b/src/main/java/com/zipcodewilmington/assessment1/Cat.java index 1cf2894..c2e1abe 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/Cat.java +++ b/src/main/java/com/zipcodewilmington/assessment1/Cat.java @@ -9,20 +9,21 @@ public class Cat extends Pet { * @param age age of this Cat */ public Cat(String name, Integer age) { - + super(name, age); } /** * @param age age of this Cat */ public Cat(Integer age) { + super(age); } /** * @param name name of this Cat */ public Cat(String name) { - + super(name); } /** @@ -32,12 +33,13 @@ public Cat(String name) { * age is 0 */ public Cat() { + } /** * @return meow as a string */ public String speak() { - return null; + return "meow"; } } diff --git a/src/main/java/com/zipcodewilmington/assessment1/Dog.java b/src/main/java/com/zipcodewilmington/assessment1/Dog.java index bca1c07..277f976 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/Dog.java +++ b/src/main/java/com/zipcodewilmington/assessment1/Dog.java @@ -38,6 +38,6 @@ public Dog() { * @return bark as a string */ public String speak() { - return null; + return "bark"; } } diff --git a/src/main/java/com/zipcodewilmington/assessment1/Pet.java b/src/main/java/com/zipcodewilmington/assessment1/Pet.java index afc3e99..0b60a26 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/Pet.java +++ b/src/main/java/com/zipcodewilmington/assessment1/Pet.java @@ -9,12 +9,17 @@ public abstract class Pet implements Animal { * by default, pet has age of 0; name of ""; */ public Pet() { + String name = ""; + int age = 0; } /** * @param name name of this pet */ public Pet(String name) { + this.name = name; + this.age = 0; + } @@ -22,6 +27,9 @@ public Pet(String name) { * @param age age of this pet */ public Pet(int age) { + this.age = age; + this.name = ""; + } /** @@ -29,20 +37,22 @@ public Pet(int age) { * @param age age of this pet */ public Pet(String name, int age) { + String name = name; + int age = age; } /** * @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 +60,13 @@ public Integer getAge() { * ensure this instance of `Pet` is added to the owner's composite `pets` list */ public void setOwner(PetOwner newPetOwner) { + this.PetOwner = newPetOwner; } /** * @return PetOwner object whose composite `pets` collection contains this Pet instance */ public PetOwner getOwner() { - return null; + return petOwner; } } diff --git a/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java b/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java index 326ada5..8f71b5e 100644 --- a/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java +++ b/src/main/java/com/zipcodewilmington/assessment1/PetOwner.java @@ -9,12 +9,15 @@ public class PetOwner { * @param pets array of Pet object */ public PetOwner(String name, Pet... pets) { + this.name = name; + this.Pets = pets; } /** * @param pet pet to be added to the composite collection of Pets */ public void addPet(Pet pet) { + this.Pets.add(pet); } /** @@ -68,13 +71,13 @@ public Integer getNumberOfPets() { * @return the name property of the Pet */ public String getName() { - return null; + return name; } /** * @return array representation of animals owned by this PetOwner */ public Pet[] getPets() { - return null; + return Pets; } }