diff --git a/Zoo/src/AnimalNoise.java b/Zoo/src/AnimalNoise.java index 3a0f77a..00cda55 100644 --- a/Zoo/src/AnimalNoise.java +++ b/Zoo/src/AnimalNoise.java @@ -1,6 +1,7 @@ import model.Example; import model.Parrot; +import model.Sloth; public class AnimalNoise { @@ -18,6 +19,13 @@ public static void main(String[] args) { // Printing the result of the makeNoise method from the Parrot class System.out.println(parrot.makeNoise()); + + //creating instance of Sloth object + Sloth sloth = new Sloth("Three-toed Sloth", "Central and South America", 3); + + System.out.println(sloth.makeNoise()); + + } } diff --git a/Zoo/src/model/Sloth.java b/Zoo/src/model/Sloth.java new file mode 100644 index 0000000..04c35a6 --- /dev/null +++ b/Zoo/src/model/Sloth.java @@ -0,0 +1,79 @@ +/** + * + */ +package model; + +/** + * @author Amy Miles - almiles + * CIS175 Fall 2023 + * Aug 27, 2023 + */ +public class Sloth { + + private String name; + private String habitat; + private int age; + /** + * Default + */ + public Sloth() { + super(); + } + /** + * @param name + * @param habitat + * @param age + */ + public Sloth(String name, String habitat, int age) { + super(); + this.name = name; + this.habitat = habitat; + this.age = age; + } + /** + * @return the name + */ + public String getName() { + return name; + } + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + /** + * @return the habitat + */ + public String getHabitat() { + return habitat; + } + /** + * @param habitat the habitat to set + */ + public void setHabitat(String habitat) { + this.habitat = habitat; + } + /** + * @return the age + */ + public int getAge() { + return age; + } + /** + * @param age the age to set + */ + public void setAge(int age) { + this.age = age; + } + @Override + public String toString() { + return "Sloth [name=" + name + ", habitat=" + habitat + ", age=" + age + "]"; + } + + public String makeNoise() { + return "peeeeeep!"; + } + + +}