Methods Summary |
---|
public boolean | equals(com.samscdrental.model.adt.Dollar aDollar)Indicates whether some other object is "equal to" this one.
return aDollar.theValue.equals( theValue );
|
public boolean | equals(java.lang.Object obj)Indicates whether some other object is "equal to" this one.
return equals( ( Dollar ) obj );
|
void | fromDouble(double value)
theValue = new BigDecimal( value );
|
public void | fromString(java.lang.String aString)fromString
String s = aString.trim();
s.replaceAll( ",", "" );
if ( s.startsWith( "$" ) )
{
s = s.substring( 1 );
}
try
{
theValue = new BigDecimal( s );
}
catch ( NumberFormatException exception )
{
throw new DollarFormatDeviation( ERROR_DOLLAR_BAD_FORMAT + aString );
}
return;
|
public static com.samscdrental.model.adt.Dollar | parseString(java.lang.String aString)
return new Dollar( aString );
|
public java.lang.String | toString()Returns a string representation of the object.
return NumberFormat.getCurrencyInstance().format( theValue );
|