/**
 * This program creates a few sample PetBlobs.
 * It demonstrates how to call constructors and instance methods.
 *
 * @author Zach Tomaszewski
 * @version 13 Mar 2009
 */
public class PetStore {

  public static void main(String[] args) {

    //This is how we had to create objects before writing a constructor.
    //Note how we have to initialize each field manually.
    PetBlob oldBlob = new PetBlob();
    oldBlob.name = "Wilbur";
    oldBlob.size = 100;
    oldBlob.color = "green";

    //With our new constructor that takes 3 parameters, we can do the above
    //on one line.  The constructor will also enforce that the size is > 1
    PetBlob newBlob = new PetBlob("Wilfred", 200, "blue");

    //And this calls the third constructor
    PetBlob standardBlob = new PetBlob("Saunders");

    //Now we can print out each of the 3 blobs by calling their print() method
    System.out.println("There are currently 3 PetBlobs in the pet store: ");
    oldBlob.print();
    newBlob.print();
    standardBlob.print();

    //Let's try feeding some of them
    oldBlob.feed(20);
    newBlob.feed();

    //and maybe Saunders tries to get away from someone
    standardBlob.secreteMucus();

    //see the final results
    System.out.println();
    System.out.println("After some feeding and mucus secretion: ");
    oldBlob.print();
    newBlob.print();
    standardBlob.print();


    //Note that Saunders's size is now less than 1, which doesn't quite make
    //sense.  Also, because a PetBlob's instance variables are all public
    //any other class could change them to any value at any time, introducing
    //possible errors or just violating the PetBlob design by changing a blob's
    //color after creation or making the size negative.
    //
    //Next week we'll revisit this example to see how we can apply the concept
    //of encapsulation to prevent this.

  }

}
