Skip to content
Closed
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
84e3bca
First 3 exercises of sprint 1 are completed.
eminakturk Jun 25, 2025
3c9fb3a
Key exercise part is done with this commit
eminakturk Jun 25, 2025
c882576
Mandatory errors 0 and 1.js is solved.
eminakturk Jun 25, 2025
8ccf3b2
Mandatory-errors part is finished.
eminakturk Jun 25, 2025
d0c0bd7
until time format is finished.
eminakturk Jun 27, 2025
721fe57
finishing touch
eminakturk Jun 27, 2025
3eff2ca
get-angle-type is sorted.
eminakturk Jul 27, 2025
0de42f1
proper fraction sorted.
eminakturk Jul 27, 2025
5d8d05c
get card value sorted.
eminakturk Jul 27, 2025
7fe2790
sprint3 coursework done.
eminakturk Jul 27, 2025
fed3a0c
Merge branch 'main' into coursework/sprint3
eminakturk Jul 27, 2025
16e88b9
Delete Sprint-1/1-key-exercises/1-count.js
eminakturk Aug 4, 2025
17f9a99
Delete Sprint-1/1-key-exercises/2-initials.js
eminakturk Aug 4, 2025
4266d77
Delete Sprint-1/1-key-exercises/3-paths.js
eminakturk Aug 4, 2025
05564df
Delete Sprint-1/1-key-exercises/4-random.js
eminakturk Aug 4, 2025
a932cb1
Delete Sprint-1/2-mandatory-errors/0.js
eminakturk Aug 4, 2025
2c47ed9
Delete Sprint-1/2-mandatory-errors/1.js
eminakturk Aug 4, 2025
1b7c8c7
Delete Sprint-1/2-mandatory-errors/2.js
eminakturk Aug 4, 2025
c95381e
Delete Sprint-1/2-mandatory-errors/3.js
eminakturk Aug 4, 2025
1fd0b02
Delete Sprint-1/2-mandatory-errors/4.js
eminakturk Aug 4, 2025
71b7003
Delete Sprint-1/3-mandatory-interpret/1-percentage-change.js
eminakturk Aug 4, 2025
0c7b105
Delete Sprint-1/3-mandatory-interpret/2-time-format.js
eminakturk Aug 4, 2025
97d27ed
Delete Sprint-1/3-mandatory-interpret/3-to-pounds.js
eminakturk Aug 4, 2025
47d5d46
the errors mentioned are fixed.
eminakturk Aug 12, 2025
2f97455
Merge branch 'coursework/sprint3' of https://github.com/eminakturk/Mo…
eminakturk Aug 12, 2025
29d0ece
Merge branch 'main' into coursework/sprint3
eminakturk Aug 13, 2025
315d99a
latest error fix.
eminakturk Aug 14, 2025
d31e82f
Merge branch 'coursework/sprint3' of https://github.com/eminakturk/Mo…
eminakturk Aug 14, 2025
cf78bda
fixes back to deleted files.
eminakturk Aug 20, 2025
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
6 changes: 0 additions & 6 deletions Sprint-1/1-key-exercises/1-count.js

This file was deleted.

11 changes: 0 additions & 11 deletions Sprint-1/1-key-exercises/2-initials.js

This file was deleted.

23 changes: 0 additions & 23 deletions Sprint-1/1-key-exercises/3-paths.js

This file was deleted.

9 changes: 0 additions & 9 deletions Sprint-1/1-key-exercises/4-random.js

This file was deleted.

2 changes: 0 additions & 2 deletions Sprint-1/2-mandatory-errors/0.js

This file was deleted.

4 changes: 0 additions & 4 deletions Sprint-1/2-mandatory-errors/1.js

This file was deleted.

5 changes: 0 additions & 5 deletions Sprint-1/2-mandatory-errors/2.js

This file was deleted.

9 changes: 0 additions & 9 deletions Sprint-1/2-mandatory-errors/3.js

This file was deleted.

2 changes: 0 additions & 2 deletions Sprint-1/2-mandatory-errors/4.js

This file was deleted.

22 changes: 0 additions & 22 deletions Sprint-1/3-mandatory-interpret/1-percentage-change.js

This file was deleted.

25 changes: 0 additions & 25 deletions Sprint-1/3-mandatory-interpret/2-time-format.js

This file was deleted.

27 changes: 0 additions & 27 deletions Sprint-1/3-mandatory-interpret/3-to-pounds.js

This file was deleted.

48 changes: 43 additions & 5 deletions Sprint-3/1-key-implement/1-get-angle-type.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may be missing a few edge cases in your getAngleType function.

  • What if we don't pass an angle value? const nothing = getAngleType();
  • What if we pass a value that isn't a valid angle value? const tooBig = getAngleType(361);

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@
// Then, write the next test! :) Go through this process until all the cases are implemented

function getAngleType(angle) {
if (angle === 90) return "Right angle";
// read to the end, complete line 36, then pass your test here
if (angle === undefined || isNaN(angle)) {
return "Invalid angle: Please provide a valid number";
}

if (angle < 0 || angle > 360) {
return "Invalid angle: Angle must be between 0 and 360 degrees";
}

if (angle === 360 || angle === 0) return "Full rotation";

if (angle === 90) return "Right angle";
if (angle < 90) return "Acute angle";
if (angle > 90 && angle < 180) return "Obtuse angle";
if (angle === 180) return "Straight angle";
if (angle > 180 && angle < 360) return "Reflex angle";
}

// we're going to use this helper function to make our assertions easier to read
Expand Down Expand Up @@ -44,13 +57,38 @@ assertEquals(acute, "Acute angle");
// 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

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
// ====> write your test here, and then add a line to pass the test in the function above
const reflex = getAngleType(270);
assertEquals(reflex, "Reflex angle");

// Case 6: Identify Full Rotation:
// When the angle is exactly 360 degrees or 0 degrees,
// Then the function should return "Full rotation"
const fullRotation = getAngleType(360);
assertEquals(fullRotation, "Full rotation");
const zeroAngle = getAngleType(0);
assertEquals(zeroAngle, "Full rotation");

// Case 7: Handle missing input:
// When no angle is provided,
// Then the function should return an error message
const noAngle = getAngleType();
assertEquals(noAngle, "Invalid angle: Please provide a valid number");

// Case 8: Handle invalid angle values:
// When an angle outside the valid range (0-360 degrees) is provided,
// Then the function should return an error message
const tooBig = getAngleType(361);
assertEquals(tooBig, "Invalid angle: Angle must be between 0 and 360 degrees");
const negative = getAngleType(-10);
assertEquals(negative, "Invalid angle: Angle must be between 0 and 360 degrees");
12 changes: 8 additions & 4 deletions Sprint-3/1-key-implement/2-is-proper-fraction.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run this file to see if your tests pass, what happens? I get an error related to the assertEquals function. Can you find the error and fix it?

fyi: You can test the file by opening your terminal (making sure you are in the Sprint-3/1-key-implement directory) and typing:
node 2-is-proper-fraction.js

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
// write one test at a time, and make it pass, build your solution up methodically

function isProperFraction(numerator, denominator) {
if (numerator < denominator) return true;
if (Math.abs(numerator) < Math.abs(denominator)) {
return true;
} else {
return false;
}
}

// here's our helper again
Expand Down Expand Up @@ -40,14 +44,14 @@ 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
assertEquals(negativeFraction, true);

// 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
assertEquals(equalFraction, false);

// Stretch:
// What other scenarios could you test for?
// What other scenarios could you test for?
53 changes: 52 additions & 1 deletion Sprint-3/1-key-implement/3-get-card-value.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be a few edge cases missed here.

  • I expected the "Invalid card rank." assertion to be true for: const oddValue = getCardValue("345");
  • I expected the "Invalid card rank." assertion to be true for: const onlySuit = getCardValue("♠");
  • I expected the "Invalid card rank." assertion to be true for: const oneHundred = getCardValue("100♠");

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@
// write one test at a time, and make it pass, build your solution up methodically
// just make one change at a time -- don't rush -- programmers are deep and careful thinkers
function getCardValue(card) {
if (!card || card.length < 2) {
throw new Error("Invalid card rank.");
}

const rank = card.slice(0, -1);

if (rank === "A") return 11;
if (rank === "J" || rank === "Q" || rank === "K" || rank === "10") return 10;

if (!isNaN(rank) && Number(rank) >= 2 && Number(rank) <= 9 && rank.length === 1) {
return Number(rank);
}

throw new Error("Invalid card rank.");
}

// You need to write assertions for your function to check it works in different cases
Expand All @@ -33,12 +46,23 @@ 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
assertEquals(fiveofHearts, 5);

// Handle Face Cards (J, Q, K):
// Given a card with a rank of "10," "J," "Q," or "K",
// When the function is called with such a card,
// Then it should return the value 10, as these cards are worth 10 points each in blackjack.
const jackofClubs = getCardValue("J♣");
assertEquals(jackofClubs, 10);

const queenofDiamonds = getCardValue("Q♦");
assertEquals(queenofDiamonds, 10);

const kingofHearts = getCardValue("K♥");
assertEquals(kingofHearts, 10);

const tenofSpades = getCardValue("10♠");
assertEquals(tenofSpades, 10);

// Handle Ace (A):
// Given a card with a rank of "A",
Expand All @@ -49,3 +73,30 @@ const fiveofHearts = getCardValue("5♥");
// Given a card with an invalid rank (neither a number nor a recognized face card),
// When the function is called with such a card,
// Then it should throw an error indicating "Invalid card rank."
try {
getCardValue("Z♠");
console.error("Error was expected but not thrown");
} catch (e) {
assertEquals(e.message, "Invalid card rank.");
}

try {
const oddValue = getCardValue("345♠");
console.error("Error was expected but not thrown for '345♠'");
} catch (e) {
assertEquals(e.message, "Invalid card rank.");
}

try {
const onlySuit = getCardValue("♠");
console.error("Error was expected but not thrown for '♠'");
} catch (e) {
assertEquals(e.message, "Invalid card rank.");
}

try {
const oneHundred = getCardValue("100♠");
console.error("Error was expected but not thrown for '100♠'");
} catch (e) {
assertEquals(e.message, "Invalid card rank.");
}
17 changes: 15 additions & 2 deletions Sprint-3/2-mandatory-rewrite/1-get-angle-type.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may be missing a few edge cases in your getAngleType function.

  • What if we don't pass an angle value? const nothing = getAngleType();
  • What if we pass a value that isn't a valid angle value? const tooBig = getAngleType(361);

Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
function getAngleType(angle) {
if (angle === undefined || isNaN(angle)) {
return "Invalid angle: Please provide a valid number";
}

if (angle < 0 || angle > 360) {
return "Invalid angle: Angle must be between 0 and 360 degrees";
}

if (angle === 360 || angle === 0) return "Full rotation";
if (angle === 90) return "Right angle";
// replace with your completed function from key-implement

if (angle < 90) return "Acute angle";
if (angle > 90 && angle < 180) return "Obtuse angle";
if (angle === 180) return "Straight angle";
if (angle > 180 && angle < 360) return "Reflex angle";

return "Invalid angle: Please provide a valid number";
}


Expand Down
Loading
Loading