Android Open Source - TrackEveryPenny Amount

From Project

Back to project page TrackEveryPenny.


The source code is released under:

Apache License

If you think the Android project TrackEveryPenny listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ca.jbrains.upfp.model;
/*from w  w  w. j ava 2s .c  om*/
public final class Amount {
  private final int cents;

  public Amount(int cents) {
    this.cents = cents;

  public static Amount cents(int cents) {
    return new Amount(cents);

  public boolean equals(Object other) {
    if (other instanceof Amount) {
      final Amount that = (Amount) other;
      return this.cents == that.cents;
    return false;

  public int hashCode() {
    return cents;

  public String toString() {
    return String.format("%1d cents", cents);

  public double inDollars() {
    return cents / 100.0d;

Java Source Code List