public final class Transaction extends java.lang.Object implements java.lang.Comparable<Transaction>
Constructor and Description |
---|
Transaction(java.util.Date date,
java.lang.String details,
double amount)
Initializes this object based on the passed parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Transaction other)
Compares this transaction to another one.
|
boolean |
equals(java.lang.Object obj)
Determines if this object is equal to the specified object.
|
double |
getAmount()
Returns the amount of this transaction.
|
java.util.Date |
getDate()
Returns the date of this transaction.
|
java.lang.String |
getDetails()
Returns the details of this transaction.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
public Transaction(java.util.Date date, java.lang.String details, double amount)
date
- The date of the transaction.details
- The details of the transaction.amount
- The amount of the transaction. To facilitate precise
currency conversions, the values need not be rounded to two
decimal places.public java.util.Date getDate()
public java.lang.String getDetails()
public double getAmount()
public int compareTo(Transaction other)
compareTo
in interface java.lang.Comparable<Transaction>
other
- The other Transaction
object to compare.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Transaction
object, and has all
attributes identical to this object, false otherwise.public java.lang.String toString()
toString
in class java.lang.Object
Wed May 22 15:12:08 EDT 2013 A deposit $200.00