diff --git a/Sprint-3/1-key-implement/1-get-angle-type.js b/Sprint-3/1-key-implement/1-get-angle-type.js index 08d1f0cba..847665a18 100644 --- a/Sprint-3/1-key-implement/1-get-angle-type.js +++ b/Sprint-3/1-key-implement/1-get-angle-type.js @@ -43,14 +43,17 @@ assertEquals(acute, "Acute angle"); // When the angle is greater than 90 degrees and less than 180 degrees, // Then the function should return "Obtuse angle" const obtuse = getAngleType(120); -// ====> write your test here, and then add a line to pass the test in the function above +// ====> const obtuse = getAngleType(120); +//assertEquals(obtuse, "Obtuse angle"); // Case 4: Identify Straight Angles: // When the angle is exactly 180 degrees, // Then the function should return "Straight angle" -// ====> write your test here, and then add a line to pass the test in the function above +// ====> const straight = getAngleType(180); +//assertEquals(straight, "Straight angle"); // Case 5: Identify Reflex Angles: // When the angle is greater than 180 degrees and less than 360 degrees, // Then the function should return "Reflex angle" -// ====> write your test here, and then add a line to pass the test in the function above \ No newline at end of file +// ====> const straight = getAngleType(180); +//assertEquals(straight, "Straight angle"); \ No newline at end of file diff --git a/Sprint-3/1-key-implement/2-is-proper-fraction.js b/Sprint-3/1-key-implement/2-is-proper-fraction.js index 91583e941..9320f96c1 100644 --- a/Sprint-3/1-key-implement/2-is-proper-fraction.js +++ b/Sprint-3/1-key-implement/2-is-proper-fraction.js @@ -40,14 +40,33 @@ assertEquals(improperFraction, false); // target output: true // 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. const negativeFraction = isProperFraction(-4, 7); -// ====> complete with your assertion +// ====> const equalFraction = isProperFraction(3, 3); +assertEquals(equalFraction, false); + // Equal Numerator and Denominator check: // Input: numerator = 3, denominator = 3 // target output: false // Explanation: The fraction 3/3 is not a proper fraction because the numerator is equal to the denominator. The function should return false. const equalFraction = isProperFraction(3, 3); -// ====> complete with your assertion +// ====> function isProperFraction(numerator, denominator) { + if (denominator === 0) return "Undefined (denominator cannot be zero)"; // Handle division by zero + return numerator < denominator; +} + +// Helper function for assertions +//function assertEquals(actualOutput, targetOutput) { + //console.assert( + // actualOutput === targetOutput, + // `Expected ${actualOutput} to equal ${targetOutput}` + // ); +//} + +// Test for Equal Numerator and Denominator +//const equalFraction = isProperFraction(3, 3); +//assertEquals(equalFraction, false); + // Stretch: // What other scenarios could you test for? +//====>Test cases should include zero denominators, zero numerators, negative fractions, and improper fractions to ensure isProperFraction handles all scenarios correctly. \ No newline at end of file diff --git a/Sprint-3/1-key-implement/3-get-card-value.js b/Sprint-3/1-key-implement/3-get-card-value.js index aa1cc9f90..868bcb0a2 100644 --- a/Sprint-3/1-key-implement/3-get-card-value.js +++ b/Sprint-3/1-key-implement/3-get-card-value.js @@ -33,7 +33,11 @@ assertEquals(aceofSpades, 11); // When the function is called with such a card, // Then it should return the numeric value corresponding to the rank (e.g., "5" should return 5). const fiveofHearts = getCardValue("5♥"); -// ====> write your test here, and then add a line to pass the test in the function above +// ====> function getCardValue(card) { + // const rank = card[0]; // Extracts the first character (rank) from the card string + // if (!isNaN(rank)) return Number(rank); +//} + // Handle Face Cards (J, Q, K): // Given a card with a rank of "10," "J," "Q," or "K", diff --git a/Sprint-3/3-mandatory-practice/implement/count.js b/Sprint-3/3-mandatory-practice/implement/count.js index fce249650..77585cc03 100644 --- a/Sprint-3/3-mandatory-practice/implement/count.js +++ b/Sprint-3/3-mandatory-practice/implement/count.js @@ -2,4 +2,10 @@ function countChar(stringOfCharacters, findCharacter) { return 5 } -module.exports = countChar; \ No newline at end of file +module.exports = countChar; + +//=====> function countChar(stringOfCharacters, findCharacter) { + return stringOfCharacters.split(findCharacter).length - 1; +//} + +//module.exports = countChar;