diff --git a/Zoo/src/AnimalNoise.java b/Zoo/src/AnimalNoise.java index 3a0f77a..813f38e 100644 --- a/Zoo/src/AnimalNoise.java +++ b/Zoo/src/AnimalNoise.java @@ -1,6 +1,9 @@ import model.Example; import model.Parrot; +import model.Cat; +import model.Dog; +import model.Frog; public class AnimalNoise { @@ -16,8 +19,26 @@ public static void main(String[] args) { // Creating an instance of the Parrot class Parrot parrot = new Parrot("Green", "Amazon Parrot", 12); + // Creating an instance of the Cat class + Cat cat = new Cat("Brown", "Tabby", 15.5); + + // Creating an instance of the Dog class + Dog dog = new Dog("Black", "Black Lab", 60.4); + + // Creating an instance of the Frog class + Frog frog = new Frog("Green", "West African Goliath Frog", 7); + // Printing the result of the makeNoise method from the Parrot class System.out.println(parrot.makeNoise()); + + // Printing the result of the makeNoise method from the Cat class + System.out.println(cat.makeNoise()); + + // Printing the result of the makeNoise method from the Dog class + System.out.println(dog.makeNoise()); + + // Printing the result of the makeNoise method from the Frog class + System.out.println(frog.makeNoise()); } } diff --git a/Zoo/src/model/Cat.java b/Zoo/src/model/Cat.java new file mode 100644 index 0000000..a47ccc0 --- /dev/null +++ b/Zoo/src/model/Cat.java @@ -0,0 +1,65 @@ +/** + * @author Joshua Vestal-Bennett - javestalbennett + * CIS175 - Fall 2023 + * Aug 28, 2023 +*/ +package model; + +/** + * + */ +public class Cat +{ + String color; + String species; + double weight; // in pounds + + // Constructor + public Cat(String color, String species, double weight) + { + this.color = color; + this.species = species; + this.weight = weight; + } + + public String makeNoise() + { + return "Meow"; + } + + public String getColor() + { + return color; + } + + public void setColor(String color) + { + this.color = color; + } + + public String getSpecies() + { + return color; + } + + public void setSpecies(String species) + { + this.species = species; + } + + public double getWeight() + { + return weight; + } + + public void setWeight(double weight) + { + this.weight = weight; + } + + @Override + public String toString() + { + return "Cat [color=" + color + ", species=" + species + ", weight=" + weight + " pounds]"; + } +} diff --git a/Zoo/src/model/Dog.java b/Zoo/src/model/Dog.java new file mode 100644 index 0000000..63fecf0 --- /dev/null +++ b/Zoo/src/model/Dog.java @@ -0,0 +1,65 @@ +/** + * @author Joshua Vestal-Bennett - javestalbennett + * CIS175 - Fall 2023 + * Aug 28, 2023 +*/ +package model; + +/** + * + */ +public class Dog +{ + String color; + String species; + double weight; + + // Constructor + public Dog(String color, String species, double weight) + { + this.color = color; + this.species = species; + this.weight = weight; // in pounds + } + + public String makeNoise() + { + return "Bark"; + } + + public String getColor() + { + return color; + } + + public void setColor(String color) + { + this.color = color; + } + + public String getSpecies() + { + return color; + } + + public void setSpecies(String species) + { + this.species = species; + } + + public double getWeight() + { + return weight; + } + + public void setWeight(double weight) + { + this.weight = weight; + } + + @Override + public String toString() + { + return "Dog [color=" + color + ", species=" + species + ", weight=" + weight + " pounds]"; + } +} diff --git a/Zoo/src/model/Frog.java b/Zoo/src/model/Frog.java new file mode 100644 index 0000000..d650d36 --- /dev/null +++ b/Zoo/src/model/Frog.java @@ -0,0 +1,65 @@ +/** + * @author Joshua Vestal-Bennett - javestalbennett + * CIS175 - Fall 2023 + * Aug 28, 2023 +*/ +package model; + +/** + * + */ +public class Frog +{ + String color; + String species; + double weight; + + // Constructor + public Frog(String color, String species, double weight) + { + this.color = color; + this.species = species; + this.weight = weight; // in pounds + } + + public String makeNoise() + { + return "Ribbit"; + } + + public String getColor() + { + return color; + } + + public void setColor(String color) + { + this.color = color; + } + + public String getSpecies() + { + return color; + } + + public void setSpecies(String species) + { + this.species = species; + } + + public double getWeight() + { + return weight; + } + + public void setWeight(double weight) + { + this.weight = weight; + } + + @Override + public String toString() + { + return "Frog [color=" + color + ", species=" + species + ", weight=" + weight + " pounds]"; + } +}