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
7 changes: 7 additions & 0 deletions Zoo/src/AnimalNoise.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import model.Example;
import model.GrizzlyBear;
import model.Lion;
import model.Parrot;
import model.Binturong;
Expand Down Expand Up @@ -33,6 +34,12 @@ public static void main(String[] args) {

//Making noise:
System.out.println(myLion.makeNoise());

//Creating new instance of GrizzlyBear class
GrizzlyBear myBear = new GrizzlyBear("Male", 410, "Omnivorous");

//GrizzlyBear making noise
System.out.println(myBear.makeNoise());

}

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

/**
* @author Andrew May - agmay
* CIS175 - Fall 2023
* Aug 29, 2023
*/

public class GrizzlyBear {
private String sex;
private int weight; // in kilograms
private String diet;

public GrizzlyBear() {
super();
// TODO Auto-generated constructor stub
}


public GrizzlyBear(String sex, int weight, String diet) {
super();
this.sex = sex;
this.weight = weight;
this.diet = diet;
}

/**
* @return the sex
*/
public String getSex() {
return sex;
}


/**
* @param sex the sex to set
*/
public void setSex(String sex) {
this.sex = sex;
}


/**
* @return the weight
*/
public int getWeight() {
return weight;
}


/**
* @param weight the weight to set
*/
public void setWeight(int weight) {
this.weight = weight;
}


/**
* @return the diet
*/
public String getDiet() {
return diet;
}


/**
* @param diet the diet to set
*/
public void setDiet(String diet) {
this.diet = diet;
}


@Override
public String toString() {
// TODO Auto-generated method stub
return "GrizzlyBear [sex=" + sex + ", weight=" + weight + " kg, diet=" + diet + "]";
}

public String makeNoise() {
return "RRROOAARR!";
}

}