Assignments and Quizzes

Find the Errors

You will be intentionally causing and recording errors. Follow the instructions in the comments. Zip and return to me.


States and Capitols


Notice that we are NOT using move() to move the ball; we are moving the ball by X and Y offsets here (variables “velX” and “velY”. This makes it much easier to handle wall and paddle bounces.

Library Exercise ??

The goal is to practice

  • using data structures
  • using “wrapper” classes for primitive data types
  • consulting the  Java 8 API
  • using new Javadoc @ annotations
  • using code completion (optional; up to you).

You will write a BlueJ project creating a class “Month” that keeps track of the holidays in a month using a HashMap. (This is probably not a great way to do it, but, hey, this is an exercise.) You will do this in a similar fashion to the Deli FIFO Queue I demonstrated in class.

Store the information in the following class property:

private HashMap<Integer,String> holidays = new HashMap<Integer,String>();

The following instructions are my error! The idea is valid, but HashMap is smart enough to accept an int and convert automatically

Notice that you cannot use int; you must use the wrapper class Integer. It’s not hard to use, but don’t forget to use new with the constructor (I did). Refer to the Java 8 API for information about HashMap and Integer. Don’t forget to not panic.

Creating an Integer instance:

int i = 42;
Integer myInt = new Integer(i):

(end of bogus instructions)

Please do your best to use Javadoc comments as I demonstrated in class. You will need only these:

  • @author
  • @version
  • @param
  • @return

But feel free to do more if this interests you:  How to Write Doc Comments

Updates Required Below This Line —————————

Turtle Exercise