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

  public static void main(String[] args) {

    //The point of this class is to call every method of a PetBlob and test
    //that each really behaves the way it is meant to.  There are better ways
    //to structure such tests, but this way makes for more amusing output.

    //creates some blobs.  Note how we have to use one of these two constuctor
    //forms; just "new PetBlob()" won't work.
    PetBlob firstBlob = new PetBlob("Wilbur", 100, "green");
    PetBlob secondBlob = new PetBlob("Wilfred", 5, "blue");
    PetBlob thirdBlob = new PetBlob("Saunders");

    //Now we can print out each of the 3 new blobs (testing toString())
    System.out.println("There were once 3 PetBlobs in the pet store: ");
    System.out.println(firstBlob.toString());
    System.out.println(secondBlob.toString());
    //does the same as previous two lines: toString() is invoked implicitly
    System.out.println(thirdBlob);
    System.out.println();

    //Testing renaming feature: getName() and setName()
    System.out.print(firstBlob.getName() + " was purchased and renamed to ");
    firstBlob.setName("McGuffin");
    System.out.println(firstBlob.getName() + ".");
    //Test feed(int)
    System.out.print("He ate well (+40) at his new home ");
    firstBlob.feed(40);
    System.out.println("and grew accordingly (" + firstBlob.getSize() + ").");
    System.out.println();

    //Test secreteMucus() and feed()
    System.out.println("Young " + thirdBlob.getName() +
                       " tried to crawl away before being fed.");
    //since size was originally 1, this will kill the blob.  :(
    thirdBlob.secreteMucus();
    System.out.println("Though we prodded him with a stick a couple times... ");
    //test that size really doesn't decrease when dead
    thirdBlob.secreteMucus();
    thirdBlob.secreteMucus();
    System.out.println("and offered him some tidbits...");
    //and feeding doesn't revive him
    thirdBlob.feed();
    System.out.print("it seems he really was dead ");
    //test isDead()
    System.out.print("(" + thirdBlob.isDead() + "; ");
    System.out.println("size: " + thirdBlob.getSize() + ")");

    System.out.println();
    System.out.print(secondBlob.getName());
    System.out.print(" (the " + secondBlob.getColor() + " one)");
    System.out.println(" didn't sell for a long time.");
    System.out.print("We thought maybe he was too big ");
    System.out.println("(Size: " + secondBlob.getSize() + ")");
    System.out.print("  but feeding him silica gel had no effect. ");
    //feeding negative amounts should do nothing
    secondBlob.feed(-3);
    System.out.println("(Size: " + secondBlob.getSize() + ")");
    System.out.print("A bit of exercise helped though. ");
    secondBlob.secreteMucus();
    System.out.println("(Size: " + secondBlob.getSize() + ")");

  }

}
