Created
February 18, 2015 03:44
-
-
Save nbavafa/9e9e939055c7f1eeced3 to your computer and use it in GitHub Desktop.
Mammal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mammal; | |
public class Kangaroo { | |
private double pouchVolume; | |
private double highJump; | |
private double tailLength; | |
public double getpouchVolume() { | |
return pouchVolume; | |
} | |
public void setpouchVolume(double pouchVolume) { | |
this.pouchVolume = pouchVolume; | |
} | |
public double gethighJump() { | |
return highJump; | |
} | |
public void sethighJump(double highJump) { | |
this.highJump = highJump; | |
} | |
public double gettailLength() { | |
return tailLength; | |
} | |
public void settailLength(double tailLength) { | |
this.tailLength = tailLength; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mammal; | |
public class Mammal { | |
private int lifeExpectancy; | |
private int birthYear; | |
private double avgNumOffspring; | |
public int getLifeExpectancy() { | |
return lifeExpectancy; | |
} | |
public void setLifeExpectancy(int lifeExpectancy) { | |
this.lifeExpectancy = lifeExpectancy; | |
} | |
// public void setLifeExpectancy(int myLifeExpectancy) { | |
//lifeExpectancy = myLifeExpectancy; | |
///} | |
public int getBirthYear() { | |
return birthYear; | |
} | |
public void setBirthYear(int birthYear) { | |
this.birthYear = birthYear; | |
} | |
public double getAvgNumOffspring() { | |
return avgNumOffspring; | |
} | |
public void setAvgNumOffspring(double avgNumOffspring) { | |
this.avgNumOffspring = avgNumOffspring; | |
} | |
public int yearsLeft(int birthYear, int currentYear, int lifeExpectancy) { | |
int age = currentYear-birthYear; | |
return lifeExpectancy - age; | |
} | |
public int currentAge(int birthYear, int currentYear) { | |
return currentYear - birthYear; | |
} | |
public int currentAge() { | |
return currentYear() - birthYear; | |
} | |
public int yearsLeft() { | |
return lifeExpectancy - currentAge(); | |
} | |
public int currentYear() { | |
return 2015; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment