@Test public void sixtyDividedByTwelveEqualsToFiveIterative() { int dividend = 60; int divider = 12; float result = divideUsingSubtraction.divideIterative(dividend, divider); assertEquals(5, result, DELTA); }
public float divideIterative(int dividend, int divider) { validateInput(divider); float result = 0; while (dividend > divider) { dividend -= divider; result++; } float decimalPart = (float) dividend / (float) divider; result += decimalPart; return result; }
DivideUsingSubtraction { public float divideIterative(int dividend, int divider) { validateInput(divider); float result = 0; while (dividend > divider) { dividend -= divider; result++; } float decimalPart = (float) dividend / (float) divider; result += decimalPart; return result; } }
DivideUsingSubtraction { public float divideIterative(int dividend, int divider) { validateInput(divider); float result = 0; while (dividend > divider) { dividend -= divider; result++; } float decimalPart = (float) dividend / (float) divider; result += decimalPart; return result; }  }
DivideUsingSubtraction { public float divideIterative(int dividend, int divider) { validateInput(divider); float result = 0; while (dividend > divider) { dividend -= divider; result++; } float decimalPart = (float) dividend / (float) divider; result += decimalPart; return result; }  float divideIterative(int dividend, int divider); float divideRecursive(int dividend, int divider); }
DivideUsingSubtraction { public float divideIterative(int dividend, int divider) { validateInput(divider); float result = 0; while (dividend > divider) { dividend -= divider; result++; } float decimalPart = (float) dividend / (float) divider; result += decimalPart; return result; }  float divideIterative(int dividend, int divider); float divideRecursive(int dividend, int divider);  }