package tutorial.jdo;
/**
* Animal class for use in the pet store tutorial.
*/
public abstract class Animal {
private String name = null;
private float price = 0f;
/**
* Constructor.
*
* @param name This animal's name.
* @param price The price of the animal, in dollars.
*/
public Animal(String name, float price) {
this.name = name;
this.price = price;
}
/**
* Return the animal's name.
*/
public String getName() {
return name;
}
/**
* Return the price of the animal in dollars.
*/
public float getPrice() {
return price;
}
/**
* Return a useful informational string describing this animal.
*/
public String toString() {
return toString(false);
}
/**
* Return an informational string describing this animal; if
* detailed
is true
, return
* a more verbose description of the animal.
*
* @param detailed a boolean that controls the verbosity of the returned
* string
*/
public abstract String toString(boolean detailed);
}