You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Explanation: The fraction -4/7 is a proper fraction because the absolute value of the numerator (4) is less than the denominator (7). The function should return true.
48
54
constnegativeFraction=isProperFraction(-4,7);
49
-
// ====> complete with your assertion
55
+
assertEquals(negativeFraction,true);
50
56
51
57
// Equal Numerator and Denominator check:
52
58
// Input: numerator = 3, denominator = 3
53
59
// target output: false
54
60
// Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false.
55
61
constequalFraction=isProperFraction(3,3);
56
-
// ====> complete with your assertion
62
+
assertEquals(equalFraction,false);
57
63
58
64
// Stretch:
59
65
// What other scenarios could you test for?
66
+
67
+
// Both Numerator and Denominator Negative check:
68
+
// Input: numerator = -4, denominator = -9
69
+
// target output: false
70
+
// Explanation: The fraction -4/-9 is equivalent to 4/9, which is a proper fraction. Function should return false.
71
+
constbothNegative=isProperFraction(-4,-9);
72
+
assertEquals(bothNegative,false);
73
+
74
+
// Zero Numerator check:
75
+
// Input: numerator = 0, denominator = 7
76
+
// target output: true
77
+
// Explanation: The fraction 0/7 is a proper fraction because the numerator is less than the denominator. The function should return true.
78
+
constzeroNumerator=isProperFraction(0,7);
79
+
assertEquals(zeroNumerator,true);
80
+
81
+
// Zero Denominator check:
82
+
// Input: numerator = 2, denominator = 0
83
+
// target output: false
84
+
// Explanation: The fraction 2/0 is undefined because division by zero is not allowed. The function should return false.
0 commit comments