To get started, download and unzip this script.
In the folder you unzipped there is a Python script ball.py Run the this script using Python3. As you can see, this script uses Tkinter to move a little red ball horizontally across the display. Looking at the code, you'll see a Ball class that has an instance variable supporting the direction of movement, and an instance variable flagging for user-requested quit. To complete this exercise, you will add a threaded function that will loop forever, asking the user whether they want to move the ball left, move it right, or exit the program (use Python's built-in input function), and setting the appropriate instance variable (the existing code will take care of the rest).
In the folder you unzipped there are also three small Java source files: ClassA.java, ClassB.java, and GreeterInterface.java. To keep things simple, we'll compile and run this code directly from the command-line in a terminal window (I'm using % to indicate the command-line prompt):
% javac ClassA.java % java ClassATake a few minutes to look over the contents of these three small source files. Then modify ClassA.java (and no other file!) to use an anonymous inner class with @Override. To see how you'll do this, look at an example in our textbook, or do what I did: just google java anonymous inner class. The examples you will find will likely be a lot more complicated than what you need to do here, which is the whole idea: we are using a bare-bones example to to understand the idiom of anonymous inner classes, apart from their use in Android development.
% python3 ball.py % % javac ClassA.java % java ClassAI will also look at your ClassA.java code to make sure that you rewrote it to use an anonymous inner class. Again, do not modify any other Java files, because I will use the original versions.
If you're smart, you'll set aside an extra few minutes to download your sakai submissions as test them as above.