diff --git a/Zoo/bin/.gitignore b/Zoo/bin/.gitignore new file mode 100644 index 0000000..7f870ef --- /dev/null +++ b/Zoo/bin/.gitignore @@ -0,0 +1,2 @@ +/main/ +/model/ diff --git a/Zoo/bin/main/Runner.class b/Zoo/bin/main/Runner.class index 87c83e6..123b683 100644 Binary files a/Zoo/bin/main/Runner.class and b/Zoo/bin/main/Runner.class differ diff --git a/Zoo/src/main/Runner.java b/Zoo/src/main/Runner.java index ed1b309..ac67049 100644 --- a/Zoo/src/main/Runner.java +++ b/Zoo/src/main/Runner.java @@ -1,6 +1,6 @@ package main; -import model.Example; +import model.Cow; public class Runner { @@ -9,9 +9,12 @@ public static void main(String[] args) { run.go(); } - private void go() { - Example example = new Example(); - example.makeNoise(); +private void go() { + //create instance of animal and print results + Cow myCow = new Cow("Beefalo", "Maggie", 6, "Brown"); + + System.out.println("Cow says: " + myCow.makeNoise()); + } } diff --git a/Zoo/src/model/Cow.java b/Zoo/src/model/Cow.java new file mode 100644 index 0000000..53d74b6 --- /dev/null +++ b/Zoo/src/model/Cow.java @@ -0,0 +1,76 @@ +package model; + +public class Cow{ + private String breed; + private String name; + private int age; + private String color; + + // Default constructor + public Cow() { + super(); + } + + /** + * Parameterized constructor for cow class + * @param breed The breed of the cow + * @param name The name of the cow + * @param age The age of the cow + * @param color The color of the cow + */ + public Cow(String breed, String name, int age, String color) { + super(); + this.breed = breed; + this.name = name; + this.age = age; + this.color = color; + } + + + public String getBreed() { + return breed; + } + + + public void setBreed(String breed) { + this.breed = breed; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public int getAge() { + return age; + } + + + public void setAge(int age) { + this.age = age; + } + + + public String getColor() { + return color; + } + + void setColor(String color) { + this.color = color; + } + + @Override + public String toString() { + return "Cow [name=" + name + ", breed=" + breed + ", age=" + age + ", color=" + color + "]"; + } + + + public String makeNoise() { + return "Mooooo!"; + } +} \ No newline at end of file