Class PetSet

java.lang.Object
  |
  +--PetSet

public class PetSet
extends java.lang.Object

This class is a collection of animals of various types. It manages the collection by having all the various animals do various things upon request.


Constructor Summary
PetSet()
          This default constructor creates the new animal objects, using the "new" operator and the appropriate constructors.
 
Method Summary
 void dine()
          Everybody in the set eats a large meal.
static void main(java.lang.String[] args)
          This is a simple test harness for this class.
 void reportWeights()
          Report the weight of each animal to the user by printing it on the screen.
 void snack()
          Everybody in the set eats a small meal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PetSet

public PetSet()
This default constructor creates the new animal objects, using the "new" operator and the appropriate constructors. References to the new animal objects are stored in instance variables of the PetSet object.

Method Detail

snack

public void snack()
Everybody in the set eats a small meal. This method calls the eat(food) method of each of the animal objects. The amount of food provided to each animal is half the defined meal size for that animal, whatever it might be.


dine

public void dine()
Everybody in the set eats a large meal. This method calls the eat(food) method of each of the animal objects. The amount of food provided to each animal is the same as the defined meal size for that animal, whatever that might be.


reportWeights

public void reportWeights()
Report the weight of each animal to the user by printing it on the screen.


main

public static void main(java.lang.String[] args)
This is a simple test harness for this class.

Parameters:
args - ignored