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
1 change: 1 addition & 0 deletions Zoo/bin/model/Cow.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

49 changes: 27 additions & 22 deletions Zoo/src/AnimalNoise.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,39 @@

public class AnimalNoise {

public static void main(String[] args) {
Example example = new Example();
System.out.println(example.makeNoise());

/*
*
* Add a call to your animal below this comment.
*/
public static void main(String[] args) {
Example example = new Example();
System.out.println(example.makeNoise());

// Creating an instance of the Parrot class
Parrot parrot = new Parrot("Green", "Amazon Parrot", 12);
/*
*
* Add a call to your animal below this comment.
*/

//instantiating the binturong
Binturong binturong = new Binturong("male", 25, "Black");

// Printing the result of the makeNoise method from the Parrot class
System.out.println(parrot.makeNoise());
// Creating an instance of the Parrot class
Parrot parrot = new Parrot("Green", "Amazon Parrot", 12);

// instantiating the binturong
Binturong binturong = new Binturong("male", 25, "Black");

//binturong go moo
System.out.println(binturong.speak());
// Printing the result of the makeNoise method from the Parrot class
System.out.println(parrot.makeNoise());

//New instance of Lion class
Lion myLion = new Lion("Adult", "Male", 200);
// binturong go moo
System.out.println(binturong.speak());

//Making noise:
System.out.println(myLion.makeNoise());
// New instance of Lion class
Lion myLion = new Lion("Adult", "Male", 200);

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

// New instance of Cow class
Cow myCow = new Cow("Infant", "Female", 175);

// Cow noise:
System.out.println(myCow.makeNoise());

}

}
86 changes: 86 additions & 0 deletions Zoo/src/model/Cow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* @author Michael Sedykh - masedykh
* CIS175 - Fall 2023
* Aug 30, 2023
*/


package model;

public class Lion {

private String lifeStage; //adult, infant, cowling
private String gender; //male, female, intersex
private int weight; //in kilograms

//Default constructor:
public Cow() {
super();
}

/**
* @param lifeStage
* @param gender
* @param weight
*/
public Lion(String lifeStage, String gender, int weight) {
super();
this.lifeStage = lifeStage;
this.gender = gender;
this.weight = weight;
}

/**
* @return the lifeStage
*/
public String getLifeStage() {
return lifeStage;
}

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

/**
* @return the gender
*/
public String getGender() {
return gender;
}

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

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

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

// Overrides toString method to return a string representation of the Lion object
@Override
public String toString() {

return "Cow [gender= " + gender + ", life stage = " + lifeStage + ", weight=" + weight + "kilograms. ]";
}

// Method to return the noise made by the Cow
public String makeNoise() {
return "MOOOOOOOOOOO!";
}
}