@Test public void sixtyDividedByTwelveEqualsToFiveRecursive() { int dividend = 60; int divider = 12; float result = divideUsingSubtraction.divideRecursive(dividend, divider); assertEquals(5, result, DELTA); }
public float divideRecursive(int dividend, int divider) { validateInput(divider); if (dividend == 0) { return 0f; } else if (dividend < divider) { return (float) dividend / (float) divider; } else { return 1f + divideRecursive(dividend - divider, divider); } }
DivideUsingSubtraction { public float divideRecursive(int dividend, int divider) { validateInput(divider); if (dividend == 0) { return 0f; } else if (dividend < divider) { return (float) dividend / (float) divider; } else { return 1f + divideRecursive(dividend - divider, divider); } } }
DivideUsingSubtraction { public float divideRecursive(int dividend, int divider) { validateInput(divider); if (dividend == 0) { return 0f; } else if (dividend < divider) { return (float) dividend / (float) divider; } else { return 1f + divideRecursive(dividend - divider, divider); } }  }
DivideUsingSubtraction { public float divideRecursive(int dividend, int divider) { validateInput(divider); if (dividend == 0) { return 0f; } else if (dividend < divider) { return (float) dividend / (float) divider; } else { return 1f + divideRecursive(dividend - divider, divider); } }  float divideIterative(int dividend, int divider); float divideRecursive(int dividend, int divider); }
DivideUsingSubtraction { public float divideRecursive(int dividend, int divider) { validateInput(divider); if (dividend == 0) { return 0f; } else if (dividend < divider) { return (float) dividend / (float) divider; } else { return 1f + divideRecursive(dividend - divider, divider); } }  float divideIterative(int dividend, int divider); float divideRecursive(int dividend, int divider);  }