generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 219
LONDON| MAY 2025 | HAKAN MURAT KAVUT | Module-Structuring-and-Testing-Data - Sprint 3 #611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
7df63de
Add description to count.js
hmkavut 160492f
Writing to initials variable assignment value.
hmkavut c1a5098
Creating dir and ext variable
hmkavut 19ff93a
Explanation of random
hmkavut 17e9a86
fixing error in mandatory errors
hmkavut 6bfb125
Questions in percentage-change are answered
hmkavut 9eae4db
time format questions are answered
hmkavut 21a6fe1
pound format questions are answered
hmkavut a6a69ab
strech explore questions are answered
hmkavut dbbdab3
First bug is fixed and interpreted
hmkavut d8d315c
second error is fixed and interpretted.
hmkavut 9643e13
Third problem is fixed
hmkavut 58cad7d
Mandatory debug session is completed.
hmkavut f6f291b
removed / at the end
hmkavut 94bb164
mandatory implement part is finished
hmkavut 81bff9c
Strech-extend is completed and removed console.log in time-format.
hmkavut 6dd1aa9
branch id prepared for sprint 3 and first part is implemented
hmkavut 5f4d25e
part 3 is completed
hmkavut 476b8aa
Sprint 3 tasks are completed
hmkavut 3d3ed47
Fixing 1-get-angle-type.js
hmkavut 20523a5
fixing 2-is-proper-fraction and test
hmkavut 4b83faa
fixing bugs
hmkavut 1683209
explicitly convert is removed at repeat.js
hmkavut 00db3f6
Throw error is added
hmkavut 5d1653f
Functions updated with using regex
hmkavut 66ad072
More test cases are added
hmkavut 8916254
get-card-value part bugs are fixed
hmkavut 11436ae
count parts is updated
hmkavut 89f4473
Identify the ordinal numbers test cases updated
hmkavut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
for (let a = 1; a <= 9; a++) { | ||
for (let b = 0; b <= 9; b++) { | ||
for (let c = 1; c <= 9; c++) { | ||
for (let d = 0; d <= 9; d++) { | ||
let left = Math.pow(a, b) * Math.pow(c, d); | ||
let right = parseInt(`${a}${b}${c}${d}`); | ||
|
||
if (left === right) { | ||
console.log(`Match found: (${a}^${b}) * (${c}^${d}) = ${left}`); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function transposeTwoStrings(array) { | ||
let a = ""; | ||
let no = Math.max(array[0].length, array[1].length); | ||
for (let i = 0; i < no; i++) { | ||
if (i < array[0].length) { | ||
a += array[0][i]; | ||
} else a += " "; | ||
a += " "; | ||
if (i < array[1].length) { | ||
a += array[1][i]; | ||
} else a += " "; | ||
if (i < array[1].length - 1 || i < array[0].length - 1) a += "\n"; | ||
} | ||
|
||
return a; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
function getAngleType(angle) { | ||
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"; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// Don't get bogged down in this detail | ||
// Jest uses CommonJS module syntax by default as it's quite old | ||
// We will upgrade our approach to ES6 modules in the next course module, so for now | ||
// We will upgrade our approach to ES6 modules in the next course module, so for now | ||
// we have just written the CommonJS module.exports syntax for you | ||
module.exports = getAngleType; | ||
module.exports = getAngleType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
if (Math.abs(numerator) < Math.abs(denominator)) return true; | ||
if (Math.abs(numerator) > Math.abs(denominator)) return true; | ||
if (Math.abs(numerator) === Math.abs(denominator)) return true; | ||
hmkavut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
module.exports = isProperFraction; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
let rank = card[0]; | ||
hmkavut marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (rank === "A") return 11; | ||
if (rank === "J" || rank === "Q" || rank === "K") return 10; | ||
if (Number(card[0]) > 0 && Number(card[0]) < 11) return Number(card[0]); | ||
return "Invalid card rank."; | ||
} | ||
module.exports = getCardValue; | ||
module.exports = getCardValue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
const getCardValue = require("./3-get-card-value"); | ||
|
||
test("should return 11 for Ace of Spades", () => { | ||
const aceofSpades = getCardValue("A♠"); | ||
expect(aceofSpades).toEqual(11); | ||
}); | ||
const aceofSpades = getCardValue("A♠"); | ||
expect(aceofSpades).toEqual(11); | ||
}); | ||
|
||
// Case 2: Handle Number Cards (2-10): | ||
test("should return number for card number bw 2-10", () => { | ||
const fiveofHearts = getCardValue("5♥"); | ||
expect(fiveofHearts).toEqual(5); | ||
}); | ||
// Case 3: Handle Face Cards (J, Q, K): | ||
test("should return number for face of cards", () => { | ||
const faceofHearts = getCardValue("J♥"); | ||
expect(faceofHearts).toEqual(10); | ||
}); | ||
// Case 4: Handle Ace (A): | ||
test("should return number for face of cards", () => { | ||
const aceofHearts = getCardValue("A♥"); | ||
expect(aceofHearts).toEqual(11); | ||
}); | ||
// Case 5: Handle Invalid Cards: | ||
test("should return number for face of cards", () => { | ||
const invalidCard = getCardValue("C♥"); | ||
expect(invalidCard).toEqual("Invalid card rank."); | ||
}); | ||
hmkavut marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
function countChar(stringOfCharacters, findCharacter) { | ||
return 5 | ||
if (!stringOfCharacters.includes(findCharacter)) { | ||
return "No occurrence"; | ||
} | ||
hmkavut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
let count = 0; | ||
for (let char of stringOfCharacters) { | ||
if (char === findCharacter) { | ||
count++; | ||
} | ||
} | ||
return count; | ||
} | ||
|
||
|
||
module.exports = countChar; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
function getOrdinalNumber(num) { | ||
return "1st"; | ||
if (num % 10 ==1 && num % 100 !=11 ) | ||
return "1st"; | ||
if (num % 10 ==2 && num % 100 !=12 ) | ||
return "2nd"; | ||
if (num % 10 ==3 && num % 100 !=13 ) | ||
return "3rd"; | ||
return "th" | ||
} | ||
|
||
module.exports = getOrdinalNumber; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
function repeat() { | ||
return "hellohellohello"; | ||
function repeat(str, count) { | ||
|
||
if (Number(count) > 1) { | ||
hmkavut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
let result="" | ||
for (let i = 0; i <= count-1; i++) { | ||
result += str; | ||
} | ||
return result; | ||
} | ||
if (count == 1) return str; | ||
if (count == 0) return ""; | ||
return "Negative counts are not valid."; | ||
hmkavut marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} | ||
|
||
module.exports = repeat; | ||
module.exports = repeat; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.