next up previous
Next: Lab Exercise 7: Adding Up: In the Laboratory: CyberPetApplet Previous: Lab Exercise 5: Paying

Lab Exercise 6: Adding a New State to CyberPet

Add a third state to the CyberPet class and make the appropriate changes in the CyberPetApplet. Let's suppose you are adding a thinking state. You will need to create an instance variable for isThinking and a think() method, plus you need to revise the other access methods. All of these revisions would occur in the CyberPet.java file. In the CyberPetApplet.java file, you would need to add a third button to the applet. If you add a third button, you would need to revise the actionPerformed() method to handle clicks on the new button.



Ralph Morelli {Faculty}
12/22/1999