/* * File: TestCyberPet.java * Author: Java, Java, Java * Description: This class provides a user interface to the * CyberPet class. It creates two CyberPet instances, one * named "Socrates" and one named "Plato," and then it * uses CyberPet's public methods to get the pets to eat and sleep, * or to change the pet's name. */ public class TestCyberPet { public static void main (String argv[]) { CyberPet pet1; // Declare CyberPet variables CyberPet pet2; pet1 = new CyberPet(); // Instantiate the references pet1.setName("Socrates"); // Set the pet's name pet2 = new CyberPet(); pet2.setName("Plato"); pet1.eat(); // Tell pet1 to eat pet2.sleep(); // Tell pet2 to sleep pet1.sleep(); // Tell pet1 to sleep return; // Return to the system } // main() } // TestCyberPet