Code example for BigDecimal

Methods: signum

0
    public Expense( String description, Date dateOccurred, BigDecimal amount) {
        if (description == null || dateOccurred == null || amount == null) {
            throw new IllegalArgumentException();
        } 
        // cannot record a negative expense or a zero EUR expense 
        if (amount.signum() == -1 || amount.signum() ==  0) {
            throw new IllegalArgumentException();
        } 
        this.description = description;
        this.amount = amount;
    } 
     
    public Expense( String description, int year, int month, int day, BigDecimal amount) {
        this( description, DateTime.newDate(year, month, day), amount);
    } 
     
    public BigDecimal getAmount() {
        return amount;
    }