generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 116
ITP JAN | ELVIRA MLADENOVA | MODULE-STRUCTURING AND TESTING DATA | COURSEWORK SPRINT 3 | WEEK 6 #376
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
Open
emladeno
wants to merge
17
commits into
CodeYourFuture:main
Choose a base branch
from
emladeno:coursework-sprint-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
ITP JAN | ELVIRA MLADENOVA | MODULE-STRUCTURING AND TESTING DATA | COURSEWORK SPRINT 3 | WEEK 6 #376
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fec66c9
Implement a function getAngleType and writing tests
emladeno aef2050
Implement a function isProperFraction and writing tests
emladeno 9779ee7
implement a function getCardValue and writing tests
emladeno 0472816
replace with your completed function
emladeno 7f50d7a
writing jest tests
emladeno 9d69995
add a function
emladeno 18e8499
writing 2,3,4 test cases
emladeno a7f36a1
replace with your code from key-implement
emladeno a43a0fc
handling different test cases
emladeno d3a3955
implementing a function countChar
emladeno de098a8
implementing a test no occurrences
emladeno bbb1859
implementing a function getOrdinalNumber
emladeno 761de9e
corrected function getOrdinalNumber
emladeno 1f70ec5
implementing different tests
emladeno 3d1a2b3
implementing a function repeat
emladeno 419b2eb
writing different cases
emladeno 15b7da4
I have committed the changes
emladeno 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
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
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 | ||
return Math.abs(numerator) < denominator; | ||
} | ||
// add your completed function from key-implement here | ||
|
||
|
||
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,19 @@ | ||
function getCardValue(card) { | ||
const rank = card.slice(0, -1); | ||
|
||
if (rank === "A") { | ||
return 11; | ||
} | ||
|
||
if (rank === "K" || rank === "Q" || rank === "J" || rank === "10") { | ||
return 10; | ||
} | ||
|
||
const number = parseInt(rank, 10); | ||
if (!isNaN(number) && number >= 2 && number <= 9) { | ||
return number; | ||
} | ||
throw new Error("Invalid card rank."); | ||
// replace with your code from key-implement | ||
return 11; | ||
} | ||
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
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,12 @@ | ||
function countChar(stringOfCharacters, findCharacter) { | ||
return 5 | ||
function countChar(str, char) { | ||
let count = 0; | ||
for (let i = 0; i < str.length; i++) { | ||
if ( str[i] === char) { | ||
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
21 changes: 19 additions & 2 deletions
21
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.js
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,22 @@ | ||
function getOrdinalNumber(num) { | ||
return "1st"; | ||
function getOrdinalNumber(number) { | ||
const lastTwoDigits = number % 100; | ||
|
||
if (lastTwoDigits === 11 || lastTwoDigits === 12 || lastTwoDigits === 13) { | ||
return number + "th"; | ||
} | ||
|
||
const lastDigit = number % 10; | ||
|
||
switch (lastDigit) { | ||
case 1: | ||
return number + "st"; | ||
case 2: | ||
return number + "nd"; | ||
case 3: | ||
return number + "rd"; | ||
default: | ||
return number + "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,22 @@ | ||
function repeat() { | ||
return "hellohellohello"; | ||
function repeat(str, count) { | ||
if (count < 0) { | ||
throw new Error("Count must be a non-negative integer."); | ||
} | ||
|
||
if (count === 0) { | ||
return ""; | ||
} | ||
|
||
if (count === 1) { | ||
return str; | ||
} | ||
|
||
let result = ""; | ||
for (let i = 0; i < count; i++) { | ||
result += str; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
module.exports = repeat; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check your repeat.js logic, when I run all tests, repeat.test failed. Please make sure you meet test expectations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I will check it.Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I corrected the mistake and committed the changes. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good, you can close this pr.