forked from CoachJulian/2023TeamEdgeTerm0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconditionals.js
146 lines (61 loc) · 3.71 KB
/
conditionals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* --------------------------------------------
Day 2 Challenges
-------------------------------------------- */
let message = `Welcome to Day 2
Today we are learning about conditionals.
Let's practice writing some conditionals of our own!`;
console.log(message);
const READLINE = require("readline-sync");
/* -------------------------------------------- */
console.log("------------------- Challenge 1 -------------------")
/* Can you drive?
Prompt the user to enter their age.
Write conditional statements that print out whether you can drive in your city. */
/* -------------------------------------------- */
console.log("------------------- Challenge 2 -------------------")
/* Who placed first?
Write conditional statements that checks which is the highest and prints the highest score.
Hint: Create three variables and assign them random scores. */
/* -------------------------------------------- */
console.log("------------------- Challenge 3 -------------------")
/* One of the most common parts of our daily routine is checking the weather.
Our outfit and accessories are dependent on the temperature and conditions outside.
ie. We're probably not going to wear shorts out when it's snowing...
**** Challenge 3: Part 1 ****
Write a conditional statement that checks the value of the weather variable
and prints out a weather report based on the current weather:
Rainy: Bring an umbrella
Sunny: Wear a hat and sunglasses
Snowing: Wear gloves and a scarf */
//Here's a variable to get you started:
let weather = `rainy`;
//Tip: Try changing the value of the weather variable to test your other conditions.
/**** Challenge 3: Part 2 ****
Now that you've written conditions for specific weather forecasts, let's also add in temperature!
You can't dress accordingly if you only know that it's raining outside but not how cold it is!
For example:
If it's raining and 60 degrees, you might want to bring your umbrella and wear a light jacket.
However, if it's raining and 30 degrees, you might want to break out a warmer jacket with your umbrella instead.
Add to your conditional statements above and modify your weather reports to also take into account the temperature.
Make sure to account for at least three different temperatures!
Hint: You will need another variable to keep track of the temperature.
*/
/* -------------------------------------------- */
console.log("------------------- Challenge 4 -------------------")
/* Prompt the user to enter the day of the week (1-7 representing Monday - Sunday)
Write a set of conditionals that will take a number from 1 to 7
and print out the corresponding day of the week.
Make sure to add a statement that accounts of any numbers out of range! */
/* -------------------------------------------- */
console.log("------------------- Challenge 1 -------------------")
/* A leap year is a calendar year that contains an additional day added
to keep the calendar year synchronized with the astronomical year or seasonal year.
To calculate if a specific year is/was a leap year, you can follow the following steps:
1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5.
2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4.
3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5.
4. The year is a leap year (it has 366 days).
5. The year is not a leap year (it has 365 days).
Those are a lot of conditions...
Your challenge is to translate the steps above into conditionals which will evaluate if the
year stored in a variable is/was a leap year.*/