This file contains 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
if(newNum === 0){ | |
return parseInt(binaryNum.join("")) | |
} else { | |
10100 | |
} |
This file contains 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
function convertToBinary(num, binaryNum = []){ | |
let newNum = Math.floor(num / 2) | |
let rem = num % 2 | |
if(rem !== 0){ | |
rem = 1 | |
} | |
binaryNum.unshift(rem) | |
if(newNum === 0){ |
This file contains 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
function findRangeSums1(x1,x2,y1,y2){ | |
let xRange = range(x1,x2) | |
let yRange = range(y1,y2) | |
let sums = []; | |
if(y1 > x2){ | |
return null | |
} else if (x1>y2) { | |
return null |
This file contains 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
if(y1 > x2){ | |
return null | |
} else if (x1>y2) { | |
return null | |
} |
This file contains 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
function range(low,high){ | |
let range = [] | |
for(var i = low; i<=high;i++){ | |
range.push(i) | |
} | |
return range | |
} |
This file contains 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
function arrayAlreadyHasArray(arr, testArr){ | |
for(var i = 0; i<arr.length; i++){ | |
let checker = false | |
for(var j = 0; j<arr[i].length; j++){ | |
if(arr[i][j] === testArr[j]){ | |
checker = true | |
} else { | |
checker = false | |
} | |
} |
This file contains 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
arr1 = ["N",6,4] | |
arr2 = ["N",6,4] | |
arr1Copy = arr1 | |
arr1 === arr2 // => false | |
arr1 === arr1Copy // => true |
This file contains 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
public Calc(double firstNum, double secondNum) { | |
num1 = firstNum; | |
num2 = secondNum; | |
} |
This file contains 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
switch (operator){ | |
case "+": | |
System.out.println(calc1.num1 + " plus " + calc1.num2 + " equals "+ calc1.num1 + " plus " + calc1.num2 + " equals "+calc1.add(firstNum, secondNum)); | |
backToMainMenu(); | |
break; | |
// Similar case statements as seen above, with * = multiply, ** = exponentiate, etc. | |
case "exit": | |
System.exit(0); | |
break; | |
default: |
This file contains 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
public static void main(String[] args) { | |
//nothing here yet | |
} |
NewerOlder