Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ After you have completed the requirements, try any of the following challenges.

Follow these steps for completing your project.

[ ] Submit a pull request to merge `<firstName-lastName>` branch into master. **Please don't merge your own pull request**
[x] Submit a pull request to merge `<firstName-lastName>` branch into master. **Please don't merge your own pull request**

## Resources

Expand Down
88 changes: 72 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Do the following:

HINT: no function required
*/
let votingAge = 20;

if(votingAge >= 18){
console.log(true);
}


/*
Expand All @@ -30,7 +34,12 @@ Do the following:

HINT: no function required
*/

let first = 1;
let second = 2;
if(first < second){
first = second;
}
console.log(first);



Expand All @@ -46,6 +55,8 @@ Do the following:
HINT: look up the Number method
*/

let string = "1999"
console.log(parseInt(string));



Expand All @@ -58,8 +69,9 @@ Do the following:
3. Multiply a and b and return the answer
*/

function multiply(/*add your code here*/){
/*add your code here*/
function multiply(a, b){
return a * b;

}


Expand All @@ -74,8 +86,8 @@ Do the following:
3. Return the newly calculated age
*/

function dogYears(/*add your code here*/){
/*add your code here*/
function dogYears(age){
return age * 7;
}


Expand Down Expand Up @@ -107,8 +119,26 @@ Use the hungryDog function and feeding requirements below to do the following:
NOTE: If done correctly, a weight of 15 lbs and age of 1 year would return 0.44999999999999996
*/

function hungryDog(/*add your code here*/){
/*add your code here*/
function hungryDog(weight, age){
if(age >= 1){
if(weight <= 5){
return weight * 0.05;
} else if(5 < weight && weight <= 10){
return weight * 0.04;
} else if(10 < weight && weight <= 15){
return weight * 0.03;
} else if(15 < weight){
return weight * 0.02;
}
} else {
if ((2/12) <= age && age < (4/12)){
return weight * 0.1;
} else if ((4/12) <= age && age < (7/12)){
return weight * 0.05;
} else if ((7/12) <= age && age < 1){
return weight * 0.04;
}
}
}


Expand All @@ -133,7 +163,21 @@ Use the game function below to do the following:
*/

function game(user, computer){
/*add your code here*/
if(user === computer){
return "it's a tie";
} else if(user === "scissors" && computer === "paper"){
return "you win!";
} else if(user === "paper" && computer === "scissors"){
return "you lose!";
} else if(user === "paper" && computer === "rock"){
return "you win!"
} else if(user === "rock" && computer === "paper"){
return "you lose!"
} else if(user === "rock" && computer === "scissors"){
return "you win!"
} else if(user === "scissors" && computer === "rock"){
return "you lose!"
}
}


Expand All @@ -149,8 +193,8 @@ Using the miles function below do the following:
3. Return the number of miles
*/

function miles(/*add your code here*/){
/*add your code here*/
function miles(KM){
return KM * 0.621371;
}


Expand All @@ -163,8 +207,8 @@ Using the feet function below do the following:
3. Return number of feet
*/

function feet(/*add your code here*/){
/*add your code here*/
function feet(cm){
return cm / 30.48;
}


Expand All @@ -179,8 +223,10 @@ Using the annoyingSong function below do the following:
"(number) bottles of soda on the wall, (number) bottles of soda, take one down pass it around (number left over) bottles of soda on the wall"
*/

function annoyingSong(/*add your code here*/){
/*add your code here*/
function annoyingSong(number){
for(let i = number; i => 0; i--){
return `${number} bottles of soda on the wall, ${number} bottles of soda, take one down pass it around ${number-1} bottles of soda on the wall`;
}
}


Expand All @@ -199,8 +245,18 @@ Using the grade function below do the following:
below 60 = F
*/

function grade(/*add your code here*/){
/*add your code here*/
function grade(score){
if(90 <= score){
return "you got a A";
} else if(80 <= score < 90){
return "you got a B"
} else if(70 <= score < 80){
return "you got a C"
} else if(60 <= score < 70){
return "you got a D"
} else if(score < 60){
return "you got a F"
}
}


Expand Down