Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Zoo/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/main/
/model/
Binary file modified Zoo/bin/main/Runner.class
Binary file not shown.
11 changes: 7 additions & 4 deletions Zoo/src/main/Runner.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main;

import model.Example;
import model.Cow;

public class Runner {

Expand All @@ -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());

}
}
76 changes: 76 additions & 0 deletions Zoo/src/model/Cow.java
Original file line number Diff line number Diff line change
@@ -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!";
}
}