Moody Finch

Would we rather create R2D2 or the Terminator? That's the central question behind the notion of emotional robots - if we give our robots the ability to feel, they're much less likely to annihilate the human race with nuclear weapons1 or to enslave us so that they can use us as batteries2.

Right now, the Finch doesn't have any emotions, and a world dominated by small (but coldly brutal) USB-tethered robots is only a few iterations of Moore's law away3. Save us all from this fate by extending the Finch class to give it some emotions; you will create a new class, called MoodyFinch, which has an internal emotional state. Because MoodyFinch is an extension of the Finch class, it will have all of the methods and capabilities of the Finch class, but you will add to those by writing several unique methods in MoodyFinch, specifically:

public boolean setEmotion(String setting) - Sets the internal emotion variable. Returns true if an acceptable emotion (angry, sad, happy, or blah) was used, false otherwise

public void playEmotion( ) - Plays the sequence of the current emotion

public String getEmotion( ) - Returns the Finch's current emotional state

private void angry( ) - The Finch shows that it's angry 

private void happy( ) - The Finch runs a happy routine

private void sad( ) - The Finch runs a sad routine

private void blah( ) - The Finch should act apathetic and uncaring 

The angry, happy, sad, and blah methods are private, and so can't be called by any methods outside the MoodyFinch class. Instead, people using the MoodyFinch class will call playEmotion( ) to play whichever of these four routines the Finch is feeling right now. The routines should involve use of the beak LED, the motors, and the Finch should say something or make a sound whenever one is called.

Remember that you will also need to write a client class to fully test the functionality of your MoodyFinch class.

Important Note: The Finch class is declared as final in the default version of finch.jar. To complete this assignment, you will need to replace it with this file.

1See Terminator. And Battlestar Galactica (though arguably those robots had emotions, but they should've been programmed with happier ones)

2See The Matrix

3Moore's Law