diff --git a/ATM.js b/ATM.js new file mode 100644 index 0000000..208f62e --- /dev/null +++ b/ATM.js @@ -0,0 +1,40 @@ +let checkingsAccount = 90 +let savingsAccount = 7600 +let action = 'transferToChecking' + +switch(action) { + case 'withdraw': + checkingsAccount = checkingsAccount - 100 + console.log(`Checkings: ${checkingsAccount} + Savings: ${savingsAccount} + `) + break; + + case 'deposit': + checkingsAccount = checkingsAccount - 100 + + 100 + console.log(`Checkings: ${checkingsAccount} + Savings: ${savingsAccount} + `) + break; + + case 'transferToSavings': + checkingsAccount = checkingsAccount - 100 + savingsAccount = savingsAccount + 100 + console.log(`Checkings: ${checkingsAccount} + Savings: ${savingsAccount} + `) + break + + case 'transferToChecking': + savingsAccount = savingsAccount - 100 + checkingsAccount = checkingsAccount + 100 + console.log(`Checkings: ${checkingsAccount} + Savings: ${savingsAccount} + `) + break + + default: + console.log('invalid action') + +} diff --git a/README.md b/README.md index ba50551..1644433 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## JSDR213 +## SEBR 0116 # Conditionals and Loops Lab @@ -36,11 +36,12 @@ Run a For Loop that starts at 0, ends at 10, and logs each number squared (your Create an array of foods, then loop through them. Run a conditional in your loop with the charAt[0] method so that you are only logging to your console foods that start with the letter F -## 8 - Even and Odd Numbers +## Bonus 8 - Even and Odd Numbers Run a loop that goes between 20 and 40, but only logs Even numbers. Then create a new loop that does the same for Odds -## 9 - FizzBuzz! + +## Bonus 9 - FizzBuzz! A coding classic, run a loop that counts and logs every number between 1 and 30. If a number is divisible by 3, log "Fizz", if it is divisible by 5, log "Buzz", and if it is divisible by 3 and 5, log "FizzBuzz" diff --git a/foods.js b/foods.js new file mode 100644 index 0000000..369334b --- /dev/null +++ b/foods.js @@ -0,0 +1,9 @@ +let foods = ['fudge', 'cheese', 'strawberrie', 'pinneapple', 'burrito', 'pizza', 'funnel cake', 'falafel', 'french omlet'] + +for (let i = 0; i < foods.length; i++) { + if (foods[i].charAt(0) === 'f') { + console.log(foods[i]) + } +} + +// you only need [i] when inside a function or loop \ No newline at end of file diff --git a/grade-assigner.js b/grade-assigner.js new file mode 100644 index 0000000..fcac4a4 --- /dev/null +++ b/grade-assigner.js @@ -0,0 +1,15 @@ +let grade = 90 + +if (grade >= 90) { + console.log('Wow! you got an A!') +} else if (grade <= 89 && grade >= 80) { + console.log('you got a B') +} else if (grade <= 79 && grade >= 70) { + console.log('you got a C') +} else if (grade <= 69 && grade >= 65) { + console.log('you got a D') +} else if (grade < 65) { + console.log('Sorry, you failed...') +} else { + console.log('Please enter a valid grade!') +} \ No newline at end of file diff --git a/high-five.js b/high-five.js new file mode 100644 index 0000000..622c787 --- /dev/null +++ b/high-five.js @@ -0,0 +1,3 @@ +for (let i = 0; i <= 50; i+=5) { + console.log(i) +} \ No newline at end of file diff --git a/hip-hop.js b/hip-hop.js new file mode 100644 index 0000000..758a80e --- /dev/null +++ b/hip-hop.js @@ -0,0 +1,3 @@ +for (let i=0; i<=10; i++) { + console.log(i**2) +} \ No newline at end of file diff --git a/team-player.js b/team-player.js new file mode 100644 index 0000000..311e718 --- /dev/null +++ b/team-player.js @@ -0,0 +1,7 @@ +const myTeam = ['Jordan', 'Aubrey', 'Terry', 'Dick', 'Bucky', 'Chris', 'Corey', 'Trey', 'Marley'] + +if (myTeam.length > 9) { + console.log("Play ball!") +} else { + console.log("not enough players") +} \ No newline at end of file diff --git a/weather-report.js b/weather-report.js new file mode 100644 index 0000000..858e94b --- /dev/null +++ b/weather-report.js @@ -0,0 +1,7 @@ +let temperature = 0 + +if (temperature > 75) { + console.log("its warm") +} else { + console.log("its cold") +} \ No newline at end of file