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 @@
/model/
/main/
Binary file modified Zoo/bin/main/Runner.class
Binary file not shown.
13 changes: 9 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.dog;

public class Runner {

Expand All @@ -10,8 +10,13 @@ public static void main(String[] args) {
}

private void go() {
Example example = new Example();
example.makeNoise();


//create instance of animal and print results
dog myDog = new dog("Labrador", "Max", 3, "Golden");

System.out.println("My dog says: " + myDog.bark());


}
}
2 changes: 2 additions & 0 deletions Zoo/src/model/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ public String makeNoise() {
return "Example!";
}
}


76 changes: 76 additions & 0 deletions Zoo/src/model/dog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package model;

public class dog {
private String breed;
private String name;
private int age;
private String color;

// Default constructor
public dog() {
super();
}

/**
* Parameterized constructor for dog class
* @param breed The breed of the dog
* @param name The name of the dog
* @param age The age of the dog
* @param color The color of the dog
*/
public dog(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 "dog [name=" + name + ", breed=" + breed + ", age=" + age + ", color=" + color + "]";
}


public String bark() {
return "Woof!";
}
}