applications
Class Currency2

java.lang.Object
  |
  +--applications.Currency2

public class Currency2
extends java.lang.Object


Field Summary
static boolean MINUS
           
static boolean PLUS
           
 
Constructor Summary
Currency2()
          initialize instance to $0.00
Currency2(boolean theSign, long theDollars, byte theCents)
          initialize instance to theSign $ theDollars.theCents
Currency2(double theValue)
          initialize with double
 
Method Summary
 Currency2 Add(Currency2 x)
          return this + x
 byte getCents()
           
 long getDollars()
           
 boolean getSign()
           
 Currency2 Increment(Currency2 x)
          return this incremented by x
static void main(java.lang.String[] args)
          test program
 void setCents(byte theCents)
          set cents = theCents
 void setDollars(long theDollars)
          set dollars = theDollars
 void setSign(boolean theSign)
          Set the sign of amount to theSign.
 void setValue(Currency2 x)
           
 void setValue(double theValue)
          set amount
 java.lang.String toString()
          convert to a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLUS

public static final boolean PLUS

MINUS

public static final boolean MINUS
Constructor Detail

Currency2

public Currency2()
initialize instance to $0.00

Currency2

public Currency2(boolean theSign,
                 long theDollars,
                 byte theCents)
initialize instance to theSign $ theDollars.theCents

Currency2

public Currency2(double theValue)
initialize with double
Method Detail

getSign

public boolean getSign()
Returns:
sign

getDollars

public long getDollars()
Returns:
dollars

getCents

public byte getCents()
Returns:
cents

setSign

public void setSign(boolean theSign)
Set the sign of amount to theSign. For this to work properly amount must be nonzero.

setDollars

public void setDollars(long theDollars)
set dollars = theDollars

setCents

public void setCents(byte theCents)
set cents = theCents

setValue

public void setValue(double theValue)
set amount

setValue

public void setValue(Currency2 x)

toString

public java.lang.String toString()
convert to a string
Overrides:
toString in class java.lang.Object

Add

public Currency2 Add(Currency2 x)
return this + x

Increment

public Currency2 Increment(Currency2 x)
return this incremented by x

main

public static void main(java.lang.String[] args)
test program