Skip to content

Commit b9cda01

Browse files
author
cjyuan
committed
Fixed typo in 1-implement
1 parent 6a89a27 commit b9cda01

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// Implement a function getAngleType
22
//
33
// When given an angle in degrees, it should return a string indicating the type of angle:
4-
// - "Acute angle" for angles greater than 0 and less than 90 degrees
5-
// - "Right angle" for exactly 90 degrees
6-
// - "Obtuse angle" for angles greater than 90 degrees and less than 180 degrees
7-
// - "Straight angle" for exactly 180 degrees
8-
// - "Reflex angle" for angles greater than 180 degrees and less than 360 degrees
9-
//
10-
// If the parameter is out of the valid range, the function should return "Invalid angle".
4+
// - "Acute angle" for angles greater than 0° and less than 90°
5+
// - "Right angle" for exactly 90°
6+
// - "Obtuse angle" for angles greater than 90° and less than 180°
7+
// - "Straight angle" for exactly 180°
8+
// - "Reflex angle" for angles greater than 180° and less than 360°
9+
// - "Invalid angle" for angles outside the valid range.
1110

1211
// Assumption: The parameter is a valid number. (You do not need to handle non-numeric inputs.)
1312

@@ -16,11 +15,7 @@
1615
// execute the code to ensure all tests pass.
1716

1817
function getAngleType(angle) {
19-
if (angle === 90) {
20-
return "Right angle";
21-
}
22-
23-
// TODO: Compete the implementation
18+
// TODO: Implement this function
2419
}
2520

2621
// The line below allows us to load the getAngleType function into tests in other files.
@@ -40,4 +35,3 @@ function assertEquals(actualOutput, targetOutput) {
4035
// Example: Identify Right Angles
4136
const right = getAngleType(90);
4237
assertEquals(right, "Right angle");
43-

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Implement a function isProperFraction,
2-
// when given two numbers, a numerator and a denominator, it should return true if the
2+
// when given two numbers, a numerator and a denominator, it should return true if
33
// the given numbers form a proper fraction, and false otherwise.
44

5-
// Assumption: The parameters are always valid numbers (excluding NaN and Infinity).
5+
// Assumption: The parameters are valid numbers (not NaN or Infinity).
66

77
// Note: If you are unfamiliar with proper fractions, please look up its mathematical definition.
88

@@ -26,7 +26,7 @@ function assertEquals(actualOutput, targetOutput) {
2626
);
2727
}
2828

29-
// TODO: Write tests to cover all cases.
29+
// TODO: Write tests to cover all cases.
3030
// What combinations of numerators and denominators should you test?
3131

3232
// Example: 1/2 is a proper fraction
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
// This problem involves playing cards: https://en.wikipedia.org/wiki/Standard_52-card_deck
22

3-
// Implement a function getCardValue,
4-
// when given a string representing a playing card, it should return the numerical value of the card.
3+
// Implement a function getCardValue, when given a string representing a playing card,
4+
// should return the numerical value of the card.
55

66
// A valid card string will contain a rank followed by the suit.
77
// The rank can be one of the following strings:
88
// "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"
99
// The suit can be one of the following emojis:
1010
// "♠", "♥", "♦", "♣"
11-
// For examples, "A♠", "2♥", "10♥", "J♣", "Q♦", "K♦".
11+
// For example: "A♠", "2♥", "10♥", "J♣", "Q♦", "K♦".
1212

1313
// When the card is an ace ("A"), the function should return 11.
1414
// When the card is a face card ("J", "Q", "K"), the function should return 10.
1515
// When the card is a number card ("2" to "10"), the function should return its numeric value.
1616

17-
// When the card string is invalid (not following the above format), the function should
17+
// When the card string is invalid (not following the above format), the function should
1818
// throw an error.
1919

2020
// Acceptance criteria:
2121
// After you have implemented the function, write tests to cover all the cases, and
2222
// execute the code to ensure all tests pass.
2323

2424
function getCardValue(card) {
25-
// TODO: Complete the implementation
25+
// TODO: Implement this function
2626
}
2727

2828
// The line below allows us to load the getCardValue function into tests in other files.
@@ -38,17 +38,15 @@ function assertEquals(actualOutput, targetOutput) {
3838
}
3939

4040
// TODO: Write tests to cover all outcomes, including throwing errors for invalid cards.
41-
// Examples:
41+
// Examples:
4242
assertEquals(getCardValue("9♠"), 9);
4343

44-
4544
// Handling invalid cards
4645
try {
4746
getCardValue("invalid");
4847

4948
// This line will not be reached if an error is thrown as expected
5049
console.error("Error was not thrown for invalid card");
51-
} catch (e) {
52-
}
50+
} catch (e) {}
5351

54-
// What other invalid card cases can you think of?
52+
// What other invalid card cases can you think of?

0 commit comments

Comments
 (0)