CS 1110 Introduction to Computing using Java    Fall 2010  
9367 TR 09:05 Hollister B14 Instructors: David Gries and Lillian Lee  
9369 TR 11:15 Hollister B14 Grade: letter or S/U.   Credits: 4

Frequently asked questions (FAQ) regarding assignment A7

Q (Nov 28) "Where am I adding objects?" or "Why are some things static and some things not static?" or "How do I reference the instance of Breakout that's created by method main?"

A First, read the spec on method main carefully; it explains about the creation of an instance of Breakout and what happens next. This should help you understand the static/non-static distinctions we made.

Also, regarding class GraphicsProgram (which class Breakout extends): recall what we said in assignment A5, where we also used GraphicsProgram. Take a look at how function getTurtle worked in assignment A5 to add something to the canvas (and thus referenced the canvas).

Q (Nov 25) I have the coolest innovation ever, but it will require submitting an extra file. What should I do?

(Updated response) Please see the instructions on the CMS submission page for A7. Basically, if you are only submitting files Breakout.java and Brick.java, you submit those two files ONLY. If you need to include extra files, submit ONLY a zip file called "everything.zip" that contains all the files, including Breakout.java and Brick.java, that you have added. (Don't include the acm files.). It is YOUR responsibility to make sure you submit what is needed to compile, and you may want to include a file giving any extra instructions to explain to the grader about how to set up the files to make sure they compile.

Q (Nov 23) What kind of Exception should we use/account for in fixBricks?

A There are a couple of possible answers here. One answer: we saw an example in the Exceptions lecture of a method that had to handle illformed input (input that wasn't a String representing an int). Perhaps that example can be used as a model? (The program has been posted to the lecture summaries page). Another answer: take a look at various lists of Exceptions that can be found on the web or on the ProgramLive CD, and decide which is most appropriate. Yet another, albeit related, answer: remember that Exceptions are part of the hierarchy of Throwable objects. Take a look at the Exceptions hierarchy somewhere on the web, and choose a good subclass that will encompass the appropriate kind errors.

Q (Nov 23) "I'm having trouble beating my paddle into submission and making it listen to my mouse at will." [Actual quote! Thanks for making us smile!]

A: The assignment handout says that something has to be declared as a "listener" to the mouse, and to read the ACM documentation to find an appropriate method for this.

Let's suppose this magic method is called "addAsAListener".

Now, whose method AddAsAListener should be called? It has to be an object or class that has such a method declared in it, yes?

Moreover, refer again to our lecture on listening to GUIs. You want to register whatever it is that wants to listen with the component to whom the action is performed. Do you want the paddle to move only when the mouse is right on top of the paddle? No, you want the paddle to move whenever the mouse moves within... what object?

Q (Nov 22) What should the program do if fixBricks gets bad input?

A Carry on. (Don't change the number of bricks per row or number of rows).