@Test public void dividingByAnotherPriceResultsInARatio() { assertThat(new Price(300).divide(new Price(600))).isApproximatelyEqualTo(new Ratio(0.5), ACCURACY); assertThat(new Price(5).divide(new Price(5))).isApproximatelyEqualTo(new Ratio(1.0), ACCURACY); assertThat(new Price(513).divide(new Price(0))).isApproximatelyEqualTo(new Ratio(Double.POSITIVE_INFINITY), ACCURACY); }
public Ratio divide(final Price divisor) { return new Ratio((double) price / (double) divisor.price); }
Price implements Comparable<Price> { public Ratio divide(final Price divisor) { return new Ratio((double) price / (double) divisor.price); } }
Price implements Comparable<Price> { public Ratio divide(final Price divisor) { return new Ratio((double) price / (double) divisor.price); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); }
Price implements Comparable<Price> { public Ratio divide(final Price divisor) { return new Ratio((double) price / (double) divisor.price); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); long asPipette(); double asDouble(); Price plus(final Price other); Price plus(final int amount, final PriceUnit unit); Price plus(final double value, final RatioUnit unit); Price plus(final Ratio ratio); Price minus(final Price other); Price minus(final int amount, final PriceUnit unit); Price minus(final double value, final RatioUnit unit); Price minus(final Ratio ratio); Price inverse(); Price absolute(); Price multiply(final Ratio ratio); Money multiply(final Volume volume, final Currency currency); Ratio divide(final Price divisor); boolean isLessThan(final Price other); boolean isGreaterThan(final Price other); boolean isStrongerThan(final Price other, final MarketDirection direction); boolean isWeakerThan(final Price other, final MarketDirection direction); boolean isBetweenInclusive(final Price a, final Price b); @Override boolean equals(final Object other); @Override int compareTo(final Price other); @Override int hashCode(); String toStringWithSign(); @Override String toString(); }
Price implements Comparable<Price> { public Ratio divide(final Price divisor) { return new Ratio((double) price / (double) divisor.price); } Price(final double price);  Price(final long price);  Price(final long value, final PriceUnit unit); long asPipette(); double asDouble(); Price plus(final Price other); Price plus(final int amount, final PriceUnit unit); Price plus(final double value, final RatioUnit unit); Price plus(final Ratio ratio); Price minus(final Price other); Price minus(final int amount, final PriceUnit unit); Price minus(final double value, final RatioUnit unit); Price minus(final Ratio ratio); Price inverse(); Price absolute(); Price multiply(final Ratio ratio); Money multiply(final Volume volume, final Currency currency); Ratio divide(final Price divisor); boolean isLessThan(final Price other); boolean isGreaterThan(final Price other); boolean isStrongerThan(final Price other, final MarketDirection direction); boolean isWeakerThan(final Price other, final MarketDirection direction); boolean isBetweenInclusive(final Price a, final Price b); @Override boolean equals(final Object other); @Override int compareTo(final Price other); @Override int hashCode(); String toStringWithSign(); @Override String toString();  }