/******************************************************************************
public class Cat
{
private Double originWeight;
private Double weight;
private Double minWeight;
private Double maxWeight;
private double eatenFood;
private static int count;
public Cat()
{
this(1500.0 + 3000.0 * Math.random());
}
public Cat(double weight)
{
this(weight, weight, 1000.0, 9000.0, 0.0);
}
private Cat(double weight, double minWeight, double originWeight, double maxWeight, double eatenFood)
{
this.weight = weight;
this.originWeight = originWeight;
this.minWeight = minWeight;
this.maxWeight = maxWeight;
this.eatenFood = eatenFood;
if(isAlive())
count++;
}
Cat(double weight, double minWeight, double originWeight, double maxWeight)
{
this(weight, weight, minWeight, maxWeight, 0.0);
}
public Cat(Cat other)
{
this(other.weight, other.originWeight, other.minWeight, other.maxWeight, other.eatenFood);
}
private void setEatenFood(double eatenFood) {
this.eatenFood = eatenFood;
}
private void addEatenFood(double eatenFood) {
setEatenFood(getEatenFood() + eatenFood);
}
public double getEatenFood() {
return eatenFood;
}
public static int getCount() {
return count;
}
public void meow() {
if (isAlive()) {
addWeight(-1.0);
System.out.println("Meow");
}
}
public void feed(Double amount) {
if (isAlive()) {
addWeight(amount);
addEatenFood(amount);
}
}
public void drink(Double amount) {
addWeight(amount);
}
private void setWeight(Double weight) {
if (isAlive()) {
this.weight = weight;
if (isAlive()) {
count--;
}
}
}
private void addWeight(Double weight) {
setWeight(getWeight() + weight);
}
public Double getWeight() {
return weight;
}
public Double getOriginWeight() {
return originWeight;
}
public void restroom() {
if (isAlive()) {
double shrinkage = Math.random() * 20.0;
addWeight(-shrinkage);
System.out.println("Weight shrinkage = " + shrinkage);
}
}
public String getStatus()
{
if(weight < minWeight) {
return "Dead";
}
else if(weight > maxWeight) {
return "Exploded";
}
else if(weight > originWeight) {
return "Sleeping";
}
else {
return "Playing";
}
}
public boolean isAlive ()
{
return getWeight() >= minWeight && getWeight() <= maxWeight;
}
public Cat copy()
{
return new Cat(this);
}
public static Cat copy(Cat other)
{
return new Cat (other);
}
}