Class MyGruntWork

java.lang.Object
  |
  +--MyGruntWork
All Implemented Interfaces:
GruntWork

public class MyGruntWork
extends Object
implements GruntWork

MyGruntWork.java


Constructor Summary
MyGruntWork()
           
 
Method Summary
 double add(double x, double y)
          Returns x plus y.
 boolean and(boolean x, boolean y)
          Returns the boolean operation of x and y.
 double cm2in(double x)
          Convert centimeters to inches
 double cs101(double x, double y)
          Compute any function of x and y that you like.
 double divide(double x, double y)
          Returns x divided by y.
 double epowx(double x)
          Returns the exponential number e raised to the power of a double value
 double f2in(double x)
          Convert feet to inches
 double f2m(double x)
          Convert feet to meters
 double in2cm(double x)
          Convert inches to centimeters
 double log(double x)
          Returns the natural logarithm (base e) of a double value
 double m2cm(double x)
          Convert meters to centimeters
 double m2f(double x)
          Convert meters to feet
 void mc()
          Set the calculator's memory to 0
 double mod(double x, double y)
          Returns x modulus y.
 double mplus(double x)
          Adds the argument into the calculator's memory.
 double mr()
          Returns the value stored in memory.
 void ms(double x)
          Stores the argument into calculator's memory, wiping out what was there before
 double multiply(double x, double y)
          Returns x times y.
 boolean nand(boolean x, boolean y)
          Returns the boolean operation of not (x and y).
 double negate(double x)
          Returns the negated value of a double value
 boolean or(boolean x, boolean y)
          Returns the boolean operation of x or y.
 double subtract(double x, double y)
          Returns x minus y.
 boolean xor(boolean x, boolean y)
          Returns the boolean operation of x xor y.
 double xpowm(double x)
          Returns x raised to the power of the value stored in memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyGruntWork

public MyGruntWork()
Method Detail

negate

public double negate(double x)
Description copied from interface: GruntWork
Returns the negated value of a double value

Specified by:
negate in interface GruntWork
Returns:
the negative of x

log

public double log(double x)
Description copied from interface: GruntWork
Returns the natural logarithm (base e) of a double value

Specified by:
log in interface GruntWork
Returns:
natural log of x

xpowm

public double xpowm(double x)
Description copied from interface: GruntWork
Returns x raised to the power of the value stored in memory.

Specified by:
xpowm in interface GruntWork
Returns:
x to the power of the calculator's memory

epowx

public double epowx(double x)
Description copied from interface: GruntWork
Returns the exponential number e raised to the power of a double value

Specified by:
epowx in interface GruntWork
Returns:
e to the x

m2f

public double m2f(double x)
Convert meters to feet

Specified by:
m2f in interface GruntWork
Parameters:
x - some number of meters
Returns:
the value of x in feet

f2m

public double f2m(double x)
Convert feet to meters

Specified by:
f2m in interface GruntWork
Parameters:
x - some number of feet
Returns:
the value of x in meters

cm2in

public double cm2in(double x)
Convert centimeters to inches

Specified by:
cm2in in interface GruntWork
Parameters:
x - some number of centimeters
Returns:
the value of x in inches

in2cm

public double in2cm(double x)
Convert inches to centimeters

Specified by:
in2cm in interface GruntWork
Parameters:
x - some number of inches
Returns:
the value of x in centimeters

m2cm

public double m2cm(double x)
Convert meters to centimeters

Specified by:
m2cm in interface GruntWork
Parameters:
x - some number of meters
Returns:
the value of x in centimeters

f2in

public double f2in(double x)
Convert feet to inches

Specified by:
f2in in interface GruntWork
Parameters:
x - some number of feet
Returns:
the value of x in inches

divide

public double divide(double x,
                     double y)
Description copied from interface: GruntWork
Returns x divided by y.

Specified by:
divide in interface GruntWork
Returns:
x divided-by y

multiply

public double multiply(double x,
                       double y)
Description copied from interface: GruntWork
Returns x times y.

Specified by:
multiply in interface GruntWork
Returns:
x times y

add

public double add(double x,
                  double y)
Description copied from interface: GruntWork
Returns x plus y.

Specified by:
add in interface GruntWork
Returns:
x plus y

subtract

public double subtract(double x,
                       double y)
Description copied from interface: GruntWork
Returns x minus y.

Specified by:
subtract in interface GruntWork
Returns:
x minus y

mod

public double mod(double x,
                  double y)
Description copied from interface: GruntWork
Returns x modulus y.

Specified by:
mod in interface GruntWork
Returns:
the modulus of x and y

and

public boolean and(boolean x,
                   boolean y)
Description copied from interface: GruntWork
Returns the boolean operation of x and y.

Specified by:
and in interface GruntWork
Returns:
the "and" of the two arguments

or

public boolean or(boolean x,
                  boolean y)
Description copied from interface: GruntWork
Returns the boolean operation of x or y.

Specified by:
or in interface GruntWork
Returns:
the "or" of the two arguments

nand

public boolean nand(boolean x,
                    boolean y)
Description copied from interface: GruntWork
Returns the boolean operation of not (x and y). So returns false if x and y are true. Otherwise, returns true.

Specified by:
nand in interface GruntWork
Returns:
the complement of the "and" of the two arguments. To receive full credit, use the principle of reduction to achieve this result

xor

public boolean xor(boolean x,
                   boolean y)
Description copied from interface: GruntWork
Returns the boolean operation of x xor y. So returns true if x and y have different values. Otherwise, returns false.

Specified by:
xor in interface GruntWork
Returns:
the exclusive-or of the two arguments

mc

public void mc()
Set the calculator's memory to 0

Specified by:
mc in interface GruntWork

mr

public double mr()
Description copied from interface: GruntWork
Returns the value stored in memory.

Specified by:
mr in interface GruntWork
Returns:
the current value of the calculator's memory

ms

public void ms(double x)
Stores the argument into calculator's memory, wiping out what was there before

Specified by:
ms in interface GruntWork

mplus

public double mplus(double x)
Adds the argument into the calculator's memory.

Specified by:
mplus in interface GruntWork
Returns:
the value of the calculator's memory after the addition

cs101

public double cs101(double x,
                    double y)
Compute any function of x and y that you like. Fill in this comment block to indicate the function this method computes.

Specified by:
cs101 in interface GruntWork
Parameters:
x - What is x?
y - What is y?
Returns:
What do you return?