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
40 changes: 40 additions & 0 deletions ATM.js
Original file line number Diff line number Diff line change
@@ -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')

}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## JSDR213
## SEBR 0116

# Conditionals and Loops Lab

Expand Down Expand Up @@ -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"
9 changes: 9 additions & 0 deletions foods.js
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions grade-assigner.js
Original file line number Diff line number Diff line change
@@ -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!')
}
3 changes: 3 additions & 0 deletions high-five.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for (let i = 0; i <= 50; i+=5) {
console.log(i)
}
3 changes: 3 additions & 0 deletions hip-hop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
for (let i=0; i<=10; i++) {
console.log(i**2)
}
7 changes: 7 additions & 0 deletions team-player.js
Original file line number Diff line number Diff line change
@@ -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")
}
7 changes: 7 additions & 0 deletions weather-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let temperature = 0

if (temperature > 75) {
console.log("its warm")
} else {
console.log("its cold")
}