All pastes #914341 Raw Edit

Unnamed

public java v1 · immutable
·published 2008-02-22 20:26 UTC
rendered paste body
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package test.custom_datatype;import java.text.NumberFormat;import java.util.Locale;/** * * @author mr */public class Money implements Comparable<Money> {    public Money() {    }    public Money(Integer amount) {        this.amount = amount;    }    @Override    public String toString() {        NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.FRANCE);        return nf.format((double) (amount / 100));    }    ////////////////////////////////////////////    // JAVABEANS    Integer amount = 0;    public Integer getAmount() {        return amount;    }    public void setAmount(Integer amount) {        this.amount = amount;    }    ///////////////////////////////////////////    // COMPARABLE IMPLEMENTATION    public int compareTo(Money o) {        return amount.compareTo(o.getAmount());    }}