CPSC 101 Computing and Algorithms I
Supplement to Tests and Exams
 

  APPENDIX A -- OPERATOR PRECEDENCE TABLE

     The following table shows the precedence assigned to Java's operators.
     The operators in this table are listed in precedence order: the higher
     in the table an operator appears, the higher its  precedence. Operators
     with higher precedence are evaluated before operators with a relatively
     lower precedence. Operators on the same line have equal precedence.

      postfix operators
                     [] . (params) expr++ expr--
      unary operators
                     ++expr --expr +expr -expr ~ !
      creation or cast
                     new (type)expr
      multiplicative
                     * / %
      additive
                     + -
      shift
                     << >> >>>
      relational
                     < > <= >= instanceof
      equality
                     == !=
      bitwise AND
                     &
      bitwise exclusive OR
                     ^
      bitwise inclusive OR
                     |
      logical AND
                     &&
      logical OR
                     ||
      conditional
                     ? :
      assignment
                     = += -= *= /= %= &= ^= |= <<= >>= >>>=
 

     When operators of equal precedence appear in the same expression,
     some rule must govern which is evaluated first. In Java, all binary
     operators except for the assignment operators are evaluated in left
     to right order. Assignment operators are evaluated right to left.

APPENDIX B--THE READUTILITY CLASS
 

Methods:
--------

     public static int readInt()
        (* reads an integer value from Standard Input *)
     public static float readFloat()
        (* reads a float value from Standard Input *)
     public static double readDouble()
        (* reads a double value from Standard Input *)
     public static String readString()
         (* reads a  String  from Standard Input *)
     public static char readChar()
         (* reads a char value from Standard Input *)
     public static void flushBuffer()
          (* clears the input buffer *)

APPENDIX C: Circle Class in Shapes Package

Variables(private):
-------------------
int radius
int centerx
int centery
 

Constructors:
-------------
  Circle(int)
     (* A constructor for the Class Circle that assigns radius *)
  Circle(int, int, int)
     (* A constructor for the Class Circle that assigns radius and coordinates
        of the center *)

Methods:
--------

  float area()
     (* A method that returns the area of the circle *)
  float circumference()
     (* A method that returns the circumference of the circle *)
  float diameter()
     (* A method that returns the diameter of the circle *)
  int getCenterx()
     (* A method that returns the x-coordinate of the center of the circle *)
  int getCentery()
     (* A method that returns the y-coordinate of the center of the circle *)
  int getRadius()
     (* A method that returns the radius of the circle *)
  void  setCenterx(int anotherCenterX)
     (* A method that assigns to the x-coordinate of the center of the circle*)
  void setContery(int anotherCenterY)
     (* A method that assigns to the y-coordinate of the center of the circle *)
  void setRadius(int anotherRadius)
     (* A method that assigns to the radius of the center of the circle *)

 APPENDIX D -- Rectangle Class in Shapes Package

Variables(private):
-------------------

int length
int width

Constructors:
-------------
  Rectangle(int l, int w)
     (* A constructor for the Class Circle that assigns length and width*)

Member Methods:
---------------
  float area()
     (* A method that returns the area of the rectangle *)
  float perimeter()
     (* A method that returns the perimeter of the rectangle *)
  float diagonal()
     (* A method that returns the diagonal of the rectangle *)
  int getLength()
     (* A method that returns the length  of the rectangle *)
  int getWidth()
     (* A method that returns the width  of the rectangle *)
  void setLength(int anotherLength)
     (* A method that assigns to the length of the rectangle*)
  void setWidth(int anotherWidth)
     (* A method that assigns to the width of the rectangle *)