Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions Sprint-3/debug/format-as-12-hours.js

This file was deleted.

2 changes: 1 addition & 1 deletion Sprint-3/implement/get-card-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Acceptance criteria:

// Given a card string in the format "A♠" (representing a card in blackjack),
// Given a card string in the format "A♠" (representing a card in blackjack - the last character will always be an emoji for a suit, and all characters before will be a number 2-10, or one letter of J, Q, K, A),
// When the function getCardValue is called with this card string as input,
// Then it should return the numerical card value

Expand Down
8 changes: 2 additions & 6 deletions Sprint-3/implement/is-valid-triangle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// STRETCH Implement a function isValidTriangle
// Implement a function isValidTriangle
// Terms
// the Triangle Inequality says: the sum of any two sides is always greater than the third side.
// practical examples:
Expand All @@ -11,15 +11,11 @@
// It's also true that b + c > a
// It's also true that a + c > b

// In our function isValidTriangle, we need to invalidate any triangle where the sum of any two sides is less than or equal to the length of the third side.
// In our function isValidTriangle which takes as parameters the lengths of three sides, we need to invalidate any triangle where the sum of any two sides is less than or equal to the length of the third side.
// and we need to validate any triangle where the sum of any two sides is greater than the length of the third side.

// Acceptance criteria:

// Given the lengths of three sides of a triangle (a, b, c),
// When the function isValidTriangle is called with these side lengths as input,
// Then it should:

// scenario: invalid triangle
// Given the side lengths a, b, and c,
// When the sum of any two side lengths is less than or equal to the length of the third side (i.e., a + b <= c, a + c <= b, b + c <= a),
Expand Down
13 changes: 7 additions & 6 deletions Sprint-3/implement/rotate-char.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@

// Acceptance criteria:

// Given a character (char) and a shift value (shift),
// Given a character and a shift value,
// When the function rotateCharacter is called with these inputs,
// Then it should:

// Scenario: Rotate Lowercase Letters:
// Given a lowercase letter character (char) and a positive integer shift,
// Given a lowercase letter character and a positive integer shift,
// When the function is called with these inputs,
// Then it should rotate the lowercase letter by shift positions within the lowercase alphabet, wrapping around if necessary, and return the rotated lowercase letter as a string.
console.log(rotateCharacter("a", 3)); // Output: "d"
console.log(rotateCharacter("f", 1)); // Output: "f"
console.log(rotateCharacter("f", 1)); // Output: "g"

// Scenario: Rotate Uppercase Letters:
// Given an uppercase letter character (char) and a positive integer shift,
// Given an uppercase letter character and a positive integer shift,
// When the function is called with these inputs,
// Then it should rotate the uppercase letter by shift positions within the uppercase alphabet, wrapping around if necessary, and return the rotated uppercase letter as a string.
console.log(rotateCharacter("A", 3)); // Output: "D"
console.log(rotateCharacter("F", 1)); // Output: "G"

// Scenario: Leave Non-Letter Characters Unchanged:
// Given a character (char) that is not a letter (neither uppercase nor lowercase) and any positive or negative shift value,
// Given a character that is not a letter (neither uppercase nor lowercase) and any positive or negative shift value,
// When the function is called with these inputs,
// Then it should return the character unchanged.
// This specification outlines the behavior of the rotateCharacter function for different input scenarios, including valid and invalid characters, and defines the expected output or action for each case.
Expand All @@ -39,4 +39,5 @@ console.log(rotateCharacter("7", 5)); // Output: "7" (unchanged, not a letter)
// When the rotateCharacter function is called with char and shift as inputs,
// Then it should correctly rotate the character by shift positions within the alphabet while handling the wraparound,
// And the function should return the rotated character as a string (e.g., 'z' rotated by 3 should become 'c', 'Z' rotated by 3 should become 'C').
console.log(rotateCharacter("z", 1)); // Output: "a" (unchanged, not a letter)
console.log(rotateCharacter("z", 1)); // Output: "a" (preserves case, but wraps around)
console.log(rotateCharacter("Y", 2)); // Output: "A" (preserves case, but wraps around)
22 changes: 2 additions & 20 deletions Sprint-3/readme.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
# 🧭 Guide to week 3 exercises

## 🐛 Debug

First off, `format-as-12-hours.js` has a 🐛.

a) Write an assertion to check the output of `formatAs12HourClock` when it is called with an input `"17:42"`
b) Check the assertion output and try to explain what the bug is

You'll need to go back and look at some of the functions you implemented in week 2 - write down some assertions to check the functions:

- Write some assertions down for the function

## 🧹 Refactor

In these problems, you'll be _given_ an implementation and then asked to change it. Once you've updated the implementations you'll need to double check that they are still working!

## 🔧 Implement

In the `implement` directory you've got a number of functions you'll need to implement.
For each function, you also have a number of different cases you'll need to check for your function.

Use the acceptance criteria as an aid to **_write assertions_** for the different cases using `console.assert`. Use your assertions to check the functionality you're building as you go along.
Use the acceptance criteria as an aid to **_write tests_** for the different cases using Jest. Use your assertions to check the functionality you're building as you go along. Make sure you cover all edge-cases.

Here is a recommended order:

1. `get-angle-type.js`
1. `is-proper-fraction.js`
1. `get-card-value.js`
1. `is-valid-triangle.js`

## 💪 Stretch

Implement `rotateChar` as defined in `implement/rotate-char`
1. `implement/rotate-char`
5 changes: 0 additions & 5 deletions Sprint-3/refactor/format-as-12-hours.js

This file was deleted.

42 changes: 0 additions & 42 deletions Sprint-3/refactor/is-vowel.js

This file was deleted.