Skip to content

JSDR213/conditional_and_loops_lab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 

Repository files navigation

JSDR213

Conditionals and Loops Lab

1 - Weather Report

Create a variable called Temperature and set a number to its value, then create a conditional that measures this temperature. If the temperature is above 75, log "it is warm" to your console. If not, log "it is cold"

2 - Team Player

Create an array of names for your softball team. Then run a conditional to test the length of the array. If the array's length is 9 or more, log "Play ball!" to the console. If it is less than 9, log "not enough players" to the console.

3 - Grade Assigner -

Create an if/else if/else conditional that takes in a numeric grade and assigns it a letter value, logging the letter to your console. If a grade is a 90 or above, it returns an A. If it is between 80 and 89, the student recieves a B. 70-79 will give you a C. From 65 to 69 gives a D, and below a 65 returns a Failing mark. Finally, you should have a catching message that returns "Please enter a valid grade" if the inputed value is not a number

4 - ATM Function

Create 3 values, a checkingAccount, a savingsAccount, and an action type, then assign each account to have any amount of $$$ in it. Then, make a switch statement that has at least 3 different actions: Withdraw, Deposit, and Transfer. If you have a case of Withdraw, subtract $100 from one of your accounts. If your case is Deposit, add $100 to an account. If you choose Transfer, take away 100 from one account and add it to the other.

5 - High Five!

Create a for loop that starts at 0, ends at 50, and logs a number that increases by 5 each time it is run.

6 - Its Hip to Loop Squares

Run a For Loop that starts at 0, ends at 10, and logs each number squared (your answer should be 0, 1, 4, 9, 25....)

7 - F F F Foods

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

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!

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"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published