diff --git a/src/easy/3or5/plain.md b/src/easy/3or5/plain.md index 73370f1..24b114f 100644 --- a/src/easy/3or5/plain.md +++ b/src/easy/3or5/plain.md @@ -1 +1,3 @@ # Plain English Solution + +Sum up all the numbers divisible by 3 or 5 up to 1000 \ No newline at end of file diff --git a/src/easy/3or5/pseudo.md b/src/easy/3or5/pseudo.md index 520841f..8441e49 100644 --- a/src/easy/3or5/pseudo.md +++ b/src/easy/3or5/pseudo.md @@ -1 +1,7 @@ # Pseudo Code Solution + +for loop from 1 to 1000 + define sum as zero + if divisible by 3 or 5 + add this to the sum + return sum \ No newline at end of file diff --git a/src/easy/3or5/solution.js b/src/easy/3or5/solution.js index e69de29..0a70993 100644 --- a/src/easy/3or5/solution.js +++ b/src/easy/3or5/solution.js @@ -0,0 +1,9 @@ +let sum = 0 + +for (i = 1; i <=1000; i++) { + if (i % 3 === 0 || i % 5 === 0) { + sum += i + } +} + +console.log(sum) \ No newline at end of file diff --git a/src/easy/digitCount/plain.md b/src/easy/digitCount/plain.md index 73370f1..98b617b 100644 --- a/src/easy/digitCount/plain.md +++ b/src/easy/digitCount/plain.md @@ -1 +1,2 @@ # Plain English Solution +count number digits \ No newline at end of file diff --git a/src/easy/digitCount/pseudo.md b/src/easy/digitCount/pseudo.md index 520841f..34e11db 100644 --- a/src/easy/digitCount/pseudo.md +++ b/src/easy/digitCount/pseudo.md @@ -1 +1,5 @@ # Pseudo Code Solution +function countDigits(){ + + return a length of number to string +} \ No newline at end of file diff --git a/src/easy/digitCount/solution.js b/src/easy/digitCount/solution.js index e69de29..7c310ca 100644 --- a/src/easy/digitCount/solution.js +++ b/src/easy/digitCount/solution.js @@ -0,0 +1,4 @@ +function digitCount(number) { + return number.toString().length; +} +console.log(digitCount(888888)); diff --git a/src/easy/factorial/plain.md b/src/easy/factorial/plain.md index 73370f1..e99a7bd 100644 --- a/src/easy/factorial/plain.md +++ b/src/easy/factorial/plain.md @@ -1 +1,3 @@ # Plain English Solution + +Make a function that does n factorial \ No newline at end of file diff --git a/src/easy/factorial/pseudo.md b/src/easy/factorial/pseudo.md index 520841f..12b834a 100644 --- a/src/easy/factorial/pseudo.md +++ b/src/easy/factorial/pseudo.md @@ -1 +1,10 @@ # Pseudo Code Solution + +function named factorial that provides the factorial of a given number + let factNum = given number + for loop using given number minus one counting down to one inclusive + multiply factNum by i + + return factNum + + diff --git a/src/easy/factorial/solution.js b/src/easy/factorial/solution.js index e69de29..8971c3c 100644 --- a/src/easy/factorial/solution.js +++ b/src/easy/factorial/solution.js @@ -0,0 +1,9 @@ +function factorial(num){ + let factNum = num + for (i = num - 1; i > 0; i--) { + factNum *= i + } + return factNum +} + +console.log(factorial(52)) \ No newline at end of file diff --git a/src/easy/makeSentence/plain.md b/src/easy/makeSentence/plain.md index 73370f1..a217e71 100644 --- a/src/easy/makeSentence/plain.md +++ b/src/easy/makeSentence/plain.md @@ -1 +1,4 @@ # Plain English Solution + + +make a sentence the first wletter of the sentence will be captalised adda full stop if theres no punctuation else leave as it is \ No newline at end of file diff --git a/src/easy/makeSentence/pseudo.md b/src/easy/makeSentence/pseudo.md index 520841f..e239ae5 100644 --- a/src/easy/makeSentence/pseudo.md +++ b/src/easy/makeSentence/pseudo.md @@ -1 +1,5 @@ # Pseudo Code Solution +function capLetter(){ +make the first letter become captial and if theres no punctuaion then add a full stop else leave as it is + +} \ No newline at end of file diff --git a/src/easy/makeSentence/solution.js b/src/easy/makeSentence/solution.js index e69de29..77bef65 100644 --- a/src/easy/makeSentence/solution.js +++ b/src/easy/makeSentence/solution.js @@ -0,0 +1,10 @@ +function capLetter(sentence) { + let a = sentence[0].toUpperCase() + sentence.slice(1); + if (sentence[-1] === "." || sentence[-1] === "?" || sentence[-1] === "!") { + return a; + } else { + return (a += "."); + } +} + +console.log(capLetter("yay")); diff --git a/src/easy/miles/plain.md b/src/easy/miles/plain.md index 73370f1..230dcb9 100644 --- a/src/easy/miles/plain.md +++ b/src/easy/miles/plain.md @@ -1 +1,2 @@ # Plain English Solution +Change kilometers to miles using rounding function \ No newline at end of file diff --git a/src/easy/miles/pseudo.md b/src/easy/miles/pseudo.md index 520841f..237588b 100644 --- a/src/easy/miles/pseudo.md +++ b/src/easy/miles/pseudo.md @@ -1 +1,4 @@ # Pseudo Code Solution +function to take km and convert to miles + variable = km / 1.6 + return variable using round function \ No newline at end of file diff --git a/src/easy/miles/solution.js b/src/easy/miles/solution.js index e69de29..3fdc8b5 100644 --- a/src/easy/miles/solution.js +++ b/src/easy/miles/solution.js @@ -0,0 +1,6 @@ +function kmToMiles(km) { + let miles = km / 1.6 + return Math.round(miles) +} + +console.log(kmToMiles(61)) \ No newline at end of file diff --git a/src/easy/milesTravelled/plain.md b/src/easy/milesTravelled/plain.md index 73370f1..4dd1030 100644 --- a/src/easy/milesTravelled/plain.md +++ b/src/easy/milesTravelled/plain.md @@ -1 +1,2 @@ # Plain English Solution +distance(miles) =minutes multiply speed and rounding \ No newline at end of file diff --git a/src/easy/milesTravelled/pseudo.md b/src/easy/milesTravelled/pseudo.md index 520841f..7355195 100644 --- a/src/easy/milesTravelled/pseudo.md +++ b/src/easy/milesTravelled/pseudo.md @@ -1 +1,2 @@ # Pseudo Code Solution +calculate distance(miles) equal to per minutes speed *speed \ No newline at end of file diff --git a/src/easy/milesTravelled/solution.js b/src/easy/milesTravelled/solution.js index e69de29..6bcbf0f 100644 --- a/src/easy/milesTravelled/solution.js +++ b/src/easy/milesTravelled/solution.js @@ -0,0 +1,7 @@ +function distance(speed, minutes) { + let perMinuteSpeed = speed / 60; + let dist = perMinuteSpeed * minutes; + return Math.round(dist); +} + +console.log(distance); diff --git a/src/easy/multiples/plain.md b/src/easy/multiples/plain.md index 73370f1..f661694 100644 --- a/src/easy/multiples/plain.md +++ b/src/easy/multiples/plain.md @@ -1 +1,2 @@ # Plain English Solution +Use a for loop to multiply the number by each number up to and including the length and output in an array \ No newline at end of file diff --git a/src/easy/multiples/pseudo.md b/src/easy/multiples/pseudo.md index 520841f..0145102 100644 --- a/src/easy/multiples/pseudo.md +++ b/src/easy/multiples/pseudo.md @@ -1 +1,6 @@ # Pseudo Code Solution +function that takes number and length + array of multiples + for loop with i starting at 1 and ending AT length inclusive + number * i + push to an array diff --git a/src/easy/multiples/solution.js b/src/easy/multiples/solution.js index e69de29..750cc5b 100644 --- a/src/easy/multiples/solution.js +++ b/src/easy/multiples/solution.js @@ -0,0 +1,9 @@ +function multiples(num, length) { + let multiArray = [] + for (i = 1; i <= length; i++) { + multiArray.push(i * num) + } + return multiArray +} + +console.log(multiples(7,5)) \ No newline at end of file diff --git a/src/easy/random/plain.md b/src/easy/random/plain.md index 73370f1..a7e50e0 100644 --- a/src/easy/random/plain.md +++ b/src/easy/random/plain.md @@ -1 +1,2 @@ # Plain English Solution +generate a number from another 2 numbers \ No newline at end of file diff --git a/src/easy/random/pseudo.md b/src/easy/random/pseudo.md index 520841f..b4d3e8c 100644 --- a/src/easy/random/pseudo.md +++ b/src/easy/random/pseudo.md @@ -1 +1,3 @@ # Pseudo Code Solution +function that takes min and max + use random function that gives between 0 and 1 multiply by max-min and add min \ No newline at end of file diff --git a/src/easy/random/solution.js b/src/easy/random/solution.js index e69de29..e5153fe 100644 --- a/src/easy/random/solution.js +++ b/src/easy/random/solution.js @@ -0,0 +1,5 @@ +function getRandomArbitrary(num1, num2) { + return Math.random() * (num2 - num1) + num1; +} + +console.log(getRandomArbitrary(3, 12)); diff --git a/src/easy/range/plain.md b/src/easy/range/plain.md index 73370f1..ebc270c 100644 --- a/src/easy/range/plain.md +++ b/src/easy/range/plain.md @@ -1 +1,2 @@ # Plain English Solution +Find the min and max values using math.min and math.max and then subtract min from max \ No newline at end of file diff --git a/src/easy/range/pseudo.md b/src/easy/range/pseudo.md index 520841f..2fa4164 100644 --- a/src/easy/range/pseudo.md +++ b/src/easy/range/pseudo.md @@ -1 +1,5 @@ # Pseudo Code Solution +function with array arguement + varaiable 1 = math.min of array + variable 2 = math.max of array + return v2 - v1 diff --git a/src/easy/range/solution.js b/src/easy/range/solution.js index e69de29..cc8edc0 100644 --- a/src/easy/range/solution.js +++ b/src/easy/range/solution.js @@ -0,0 +1,9 @@ +function maxMinDiff(array) { + let min = Math.min(...array) + let max = Math.max(...array) + return max - min +} + +let testArray = [23, 3, 5, 66] + +console.log(maxMinDiff(testArray)) \ No newline at end of file diff --git a/src/easy/repeat/plain.md b/src/easy/repeat/plain.md index 73370f1..5087e3c 100644 --- a/src/easy/repeat/plain.md +++ b/src/easy/repeat/plain.md @@ -1 +1,2 @@ # Plain English Solution +create a string with each letter doubled \ No newline at end of file diff --git a/src/easy/repeat/pseudo.md b/src/easy/repeat/pseudo.md index 520841f..3adcc46 100644 --- a/src/easy/repeat/pseudo.md +++ b/src/easy/repeat/pseudo.md @@ -1 +1,6 @@ # Pseudo Code Solution +create a function will take a string + define an empty string + for loop + add string indexi to empty string + add string indexi to empty string diff --git a/src/easy/repeat/solution.js b/src/easy/repeat/solution.js index e69de29..6bec170 100644 --- a/src/easy/repeat/solution.js +++ b/src/easy/repeat/solution.js @@ -0,0 +1,10 @@ +function repeatString(string) { + let newString = ""; + for (let i = 0; i < string.length; i++) { + newString += string[i]; + newString += string[i]; + } + return newString; +} + +console.log(repeatString("dinner")); diff --git a/src/easy/reverse/plain.md b/src/easy/reverse/plain.md index 73370f1..f9e7723 100644 --- a/src/easy/reverse/plain.md +++ b/src/easy/reverse/plain.md @@ -1 +1,2 @@ # Plain English Solution +create a function that uses a loop to take the last of the list and puts it first in a new list and so on \ No newline at end of file diff --git a/src/easy/reverse/pseudo.md b/src/easy/reverse/pseudo.md index 520841f..0028a6e 100644 --- a/src/easy/reverse/pseudo.md +++ b/src/easy/reverse/pseudo.md @@ -1 +1,7 @@ # Pseudo Code Solution +function reverse that takes a list + create empty string + for i will be -1 and will run until negative str.length + add string index to empty string + + \ No newline at end of file diff --git a/src/easy/reverse/solution.js b/src/easy/reverse/solution.js index e69de29..71ef8ca 100644 --- a/src/easy/reverse/solution.js +++ b/src/easy/reverse/solution.js @@ -0,0 +1,13 @@ +function reverse(str) { + let newStr = "" + for (let i = str.length - 1; i >= 0; i--){ + newStr += str[i] + // console.log(newStr) + // console.log(str[i]) + } + return newStr +} + +let test1 = "hello" + +console.log(reverse('hello')) \ No newline at end of file diff --git a/src/easy/secondsInHours/solution.js b/src/easy/secondsInHours/solution.js index e69de29..6d3129f 100644 --- a/src/easy/secondsInHours/solution.js +++ b/src/easy/secondsInHours/solution.js @@ -0,0 +1,4 @@ +function countSeconds(hours) { + return hours * 3600; +} +console.log(countSeconds(20)); diff --git a/src/easy/sum/plain.md b/src/easy/sum/plain.md index 73370f1..9ff6ce5 100644 --- a/src/easy/sum/plain.md +++ b/src/easy/sum/plain.md @@ -1 +1,2 @@ # Plain English Solution +use a function that takes a starting number and ending number and use for loop to add the numbers between together \ No newline at end of file diff --git a/src/easy/sum/pseudo.md b/src/easy/sum/pseudo.md index 520841f..3eba9a8 100644 --- a/src/easy/sum/pseudo.md +++ b/src/easy/sum/pseudo.md @@ -1 +1,5 @@ # Pseudo Code Solution +function that takes min and max + variable that equals 0 + for loop + add i to variable \ No newline at end of file diff --git a/src/easy/sum/solution.js b/src/easy/sum/solution.js index e69de29..ed6abff 100644 --- a/src/easy/sum/solution.js +++ b/src/easy/sum/solution.js @@ -0,0 +1,9 @@ +function summing(start, end) { + let sum = 0 + for (let i = start; i <= end; i++){ + sum += i + } + return sum +} + +console.log(summing(1,100)) \ No newline at end of file diff --git a/src/easy/sumOfCubes/plain.md b/src/easy/sumOfCubes/plain.md index 73370f1..9821be6 100644 --- a/src/easy/sumOfCubes/plain.md +++ b/src/easy/sumOfCubes/plain.md @@ -1 +1,2 @@ # Plain English Solution +Similar to the sum, create a function that takes an array, use a for loop to cube each number in the array and sum them \ No newline at end of file diff --git a/src/easy/sumOfCubes/pseudo.md b/src/easy/sumOfCubes/pseudo.md index 520841f..c0e9888 100644 --- a/src/easy/sumOfCubes/pseudo.md +++ b/src/easy/sumOfCubes/pseudo.md @@ -1 +1,6 @@ # Pseudo Code Solution +function that takes an array + let some variable equal 0 + for (i will be used as index of array) + a new variable equal to i cubed + add new variable to some variable \ No newline at end of file diff --git a/src/easy/sumOfCubes/solution.js b/src/easy/sumOfCubes/solution.js index e69de29..1141c69 100644 --- a/src/easy/sumOfCubes/solution.js +++ b/src/easy/sumOfCubes/solution.js @@ -0,0 +1,12 @@ +function sumOfCubes(array){ + let sum = 0 + for (i = 0; i < array.length; i++){ + let cube = array[i] ** 3 + sum += cube + } + return sum +} + +let testArray = [1, 5, 9] + +console.log(sumOfCubes(testArray)) \ No newline at end of file