12A

Modify the BankAccount class from 11A to implement the Comparable interface from the Java library. (Do not write your own interface). BankAccount class will implement Comparable in addition to Qualifiable. There is a correct version of the BankAccount solution for 11a in the modules in Canvas if you need it. One BankAccount comes before another if its balance is smaller (compareTo will return a negative number). One BankAccount comes after another if its balance is larger (compareTo will return a positive number). If the two BankAccount have the same balance, then the BankAccount with the String accountId that comes first in alphabetical order is smaller. Use String's compareTo number.

For the draft, add the implements Comparable clause to the BankAccount class and then implement compareTo as a stub that always returns 0.

12A draft:
12A final:

12B

You are given a class Critter which represents an animal. Critter class will be the superclass of a set of subclasses classes. A Critter has a weight and a position on a number line. The constructor initializes the position to 0 and sets the weight from the parameter. It has an ArrayList of Strings to keep a log of its activities. It has other methods you can view by opening the class in Bluej and then selecting Documentation from the drop down menu on the right.

You are to implement the following subclasses of Critter

SpeedyCritter: A SpeedyCritter moves twice as fast as a Critter so if the SpeedyCritter's move method is called with a value of 5, it should actually move 10 steps. You will override the move method.

LazyCritter only eats and sleeps : A LazyCritter only has two activities: eat and sleep. When asked to move, it will either eat or sleep. A LazyCritter is created hungry so the first time its move method is called, the LazyCritter should eat. (and add the word "eat" to the history. The next time the move method is called, the LazyCritter will sleep (and add the word "sleep" to the history). It will continue to alternate activities in this manner. You will need a boolean variable to keep track of which activity the LazyCritter should do next. This variable should be set in such a manner in the constructor that in the first call to move method, it will eat.

StubbornCritter: A StubbornCritter only moves every third time you tell it it move. You will override the move method. If you call the StubbornCritter's move method 4 times, it will move the requested amount, not move, not move, move the requested amount. (The % operator is handy here)

DescriptiveCritter: DescriptiveCritter has an additional instance variable - a String description. It has getDescription and setDescription methods

For the draft, implement SpeedyCritter

For the final, you will need to submit all 4 subclasses

12B draft:
12B final:

12C

You will write a utility class called MyUtilities. The class will have several static methods to process arrays and array lists. It will not have any instance methods or variables. It will not have a constructor.

Supply Javadoc

For the draft, implement the first two methods along with their Javadoc.

12C draft:
12C final: