Homework Assignment #1

NAME: _________________________________________________________

DATE:  ______________

I wrote a class, BaseClass, which you have already extended for you in HmwrkClass, which mimics Integer in most ways.  If you are wondering why I didn't simply extend the Integer class, it is because integer is a "final" class which means it can not be extended.

An inheirent problem with the Integer class is that it doesn't allow you to change the value of its internal primative. Therefore write the remaining of the HmwrkClass class which will allow it add, sub, mult, divide, and set the value of HmwrkClass. There are two points for each method you are to write. The method names are written for you already. NOTE: You will need to overload the functions so that they can accept either a HmwrkClass object, or an int primative.

Assignment:  Items worth 2 points unless otherwise specified

  1. ___ Print out this page, put name on top, and finish the file which is on the web page.
  2. ___ Find the line of code:  String name = new String( /*"Place your name here." */ ); and remove the quote, placing your name in the quotes.
  3. Correctly added code for each of the methods.  18 methods total. (2 x 18 = 36 points)
    ___ Add
    ___ Add to
    ___ Subtract
    ___ Subtract from
    ___ Divide
    ___ Divide Of
    ___ Multiply
    ___ Multiply to
    ___ direct set value of
    OVERLOADED VERSIONS:
    ___ Add
    ___ Add to
    ___ Subtract
    ___ Subtract from
    ___ Divide
    ___ Divide Of
    ___ Multiply
    ___ Multiply to
    ___ direct set value of

-- Good Luck.