Skip to content
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

complete lab #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
144 changes: 144 additions & 0 deletions .results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"stats": {
"suites": 4,
"tests": 9,
"passes": 9,
"pending": 0,
"failures": 0,
"start": "2024-03-18T20:24:22.669Z",
"end": "2024-03-18T20:24:23.156Z",
"duration": 487
},
"tests": [
{
"title": "gives customers a free sample if the ride is less than or equal to 400 feet",
"fullTitle": "index.js scuberGreetingForFeet() gives customers a free sample if the ride is less than or equal to 400 feet",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 20 dollars for a distance between 400 and 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 20 dollars for a distance between 400 and 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 30 dollars for a distance over 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 30 dollars for a distance over 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "does not allow rides over 2500 feet",
"fullTitle": "index.js scuberGreetingForFeet() does not allow rides over 2500 feet",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "returns \"Ok, sounds good.\" when the city is NYC",
"fullTitle": "index.js ternaryCheckCity() returns \"Ok, sounds good.\" when the city is NYC",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"No go.\" if the destination city is not NYC",
"fullTitle": "index.js ternaryCheckCity() should return \"No go.\" if the destination city is not NYC",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you so much.\" if the tip is generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you so much.\" if the tip is generous",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you.\" if the tip is not as generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you.\" if the tip is not as generous",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Bye.\" if anything else",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Bye.\" if anything else",
"duration": 1,
"currentRetry": 0,
"err": {}
}
],
"pending": [],
"failures": [],
"passes": [
{
"title": "gives customers a free sample if the ride is less than or equal to 400 feet",
"fullTitle": "index.js scuberGreetingForFeet() gives customers a free sample if the ride is less than or equal to 400 feet",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 20 dollars for a distance between 400 and 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 20 dollars for a distance between 400 and 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "charges 30 dollars for a distance over 2000 feet",
"fullTitle": "index.js scuberGreetingForFeet() charges 30 dollars for a distance over 2000 feet",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "does not allow rides over 2500 feet",
"fullTitle": "index.js scuberGreetingForFeet() does not allow rides over 2500 feet",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "returns \"Ok, sounds good.\" when the city is NYC",
"fullTitle": "index.js ternaryCheckCity() returns \"Ok, sounds good.\" when the city is NYC",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"No go.\" if the destination city is not NYC",
"fullTitle": "index.js ternaryCheckCity() should return \"No go.\" if the destination city is not NYC",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you so much.\" if the tip is generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you so much.\" if the tip is generous",
"duration": 1,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Thank you.\" if the tip is not as generous",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Thank you.\" if the tip is not as generous",
"duration": 0,
"currentRetry": 0,
"err": {}
},
{
"title": "should return \"Bye.\" if anything else",
"fullTitle": "index.js switchOnCharmFromTip() should return \"Bye.\" if anything else",
"duration": 1,
"currentRetry": 0,
"err": {}
}
]
}
24 changes: 21 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
function scuberGreetingForFeet(){
function scuberGreetingForFeet(feet){
if (feet <=400) {return "This one is on me!"}
else if (400<= feet && feet <= 2000){return "That will be twenty bucks.";
}
else if (2000<= feet && feet <=2500){return "I will gladly take your thirty bucks.";
}
else{return "No can do."};
// Write your code here!
}

function ternaryCheckCity(){
function ternaryCheckCity(city){
return city === "NYC"?"Ok, sounds good.":"No go."
// Write your code here!
}

function switchOnCharmFromTip(){
function switchOnCharmFromTip(tip){
switch (tip){
case tip = "generous":
return "Thank you so much."
break;
case tip= "not as generous":
return "Thank you."
break;
default:
return "Bye.";

}
// Write your code here!
}