Skip to content

Commit ebb894f

Browse files
committed
Implement a function isProperFraction
1 parent e431834 commit ebb894f

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
// execute the code to ensure all tests pass.
1212

1313
function isProperFraction(numerator, denominator) {
14-
// TODO: Implement this function
14+
if (numerator > 0 && denominator > 0 && numerator < denominator) {
15+
return true;
16+
} else {
17+
return false;
18+
}
1519
}
1620

1721
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -31,3 +35,9 @@ function assertEquals(actualOutput, targetOutput) {
3135

3236
// Example: 1/2 is a proper fraction
3337
assertEquals(isProperFraction(1, 2), true);
38+
assertEquals(isProperFraction(5, 10), true);
39+
assertEquals(isProperFraction(2, 3), true);
40+
assertEquals(isProperFraction(-2, 4), false);
41+
assertEquals(isProperFraction(4, 4), false);
42+
assertEquals(isProperFraction(2, -5), false);
43+
assertEquals(isProperFraction(0, 2), false);

0 commit comments

Comments
 (0)