generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 195
Sheffield | May-2025 | Hassan Osman | Sprint-3 #580
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
HassanOHOsman
wants to merge
23
commits into
CodeYourFuture:main
Choose a base branch
from
HassanOHOsman: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
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9b98e48
implemented & tested function for all angle types
HassanOHOsman 1e65655
tested & implemented different card types
HassanOHOsman 5634292
implemented and tested the char count
HassanOHOsman 5d17a56
implemented and tested ordinal number function
HassanOHOsman 531b3ed
implemented and tested the repeat function
HassanOHOsman 1472a6e
changed to make angles <=0 evaluates to "invalid"
HassanOHOsman 0286d78
updated the last test description for more clarity.
HassanOHOsman 5bd333e
simplified the conditions of my function
HassanOHOsman 3498122
updated function implementation & tests
HassanOHOsman 33809e8
updated card function implementation & test
HassanOHOsman f8895ad
changed ordinal number function to widen range
HassanOHOsman 06411c8
corrected my empty string return
HassanOHOsman 489b22f
simplified my function
HassanOHOsman 6284562
added Math.abs()
HassanOHOsman c4a2aca
edited function to cover different suits & ranks
HassanOHOsman 7c4389d
updated tests descriptions
HassanOHOsman 499bcf1
updated tests descriptions
HassanOHOsman 34dd33f
updated the error message
HassanOHOsman 784a678
refactored Face Cards(J,Q,K) test further
HassanOHOsman 0ec98ea
refactored tests for (2-10) cards further
HassanOHOsman f7bfacf
corrected mistakes in a few of ordinal num tests
HassanOHOsman 8461178
removed a bug from ordinal number'd function
HassanOHOsman 16a010c
further refactored ordinal numbers tests
HassanOHOsman 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
function isProperFraction(numerator, denominator) { | ||
if (numerator < denominator) return true; | ||
// add your completed function from key-implement here | ||
if (Math.abs(numerator/denominator) >= 1) { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
|
||
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,28 @@ | ||
function getCardValue(card) { | ||
// replace with your code from key-implement | ||
return 11; | ||
const rank = card.slice(0, 1) | ||
switch(rank) { | ||
case "A": | ||
return 11; | ||
break; | ||
case "2": | ||
case "3": | ||
case "4": | ||
case "5": | ||
case "6": | ||
case "7": | ||
case "8": | ||
case "9": | ||
case "10": | ||
return Number(rank); | ||
break; | ||
case "J": | ||
case "K": | ||
case "Q": | ||
return 10; | ||
break; | ||
default: | ||
throw new Error("Invalid card rank"); | ||
|
||
} | ||
} | ||
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,5 @@ | ||
function countChar(stringOfCharacters, findCharacter) { | ||
return 5 | ||
function countChar(str, char) { | ||
return str.split(char).length -1; | ||
} | ||
|
||
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
22 changes: 21 additions & 1 deletion
22
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,25 @@ | ||
function getOrdinalNumber(num) { | ||
return "1st"; | ||
const lastDigit = num % 10; | ||
const lastTwoDigits = num % 100; | ||
if (lastTwoDigits >= 11 && lastTwoDigits <= 13) { | ||
return `${num}th`; | ||
} | ||
|
||
switch(lastDigit) { | ||
case 1: | ||
return `${num}st`; | ||
break; | ||
case 2: | ||
return `${num}nd`; | ||
break; | ||
case 3: | ||
return `${num}rd`; | ||
break; | ||
default: | ||
return `${num}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,13 @@ | ||
function repeat() { | ||
return "hellohellohello"; | ||
function repeat(str, count) { | ||
if(count > 0) { | ||
return str.repeat(count); | ||
} else if (count === 0) { | ||
return ""; | ||
} else { | ||
throw new Error("Invalid number"); | ||
} | ||
} | ||
|
||
module.exports = repeat; | ||
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
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.
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 don't think your implementation can pass some of the tests in this script. Have you tried executing this script to test your function implementation?
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.
Yes, some mistakes in the 2 expected values which have now been corrected.