-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathswitchStatement.js
More file actions
41 lines (34 loc) · 2.44 KB
/
switchStatement.js
File metadata and controls
41 lines (34 loc) · 2.44 KB
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
/************************************************************************************************
Task 5 (Switch Statement): (20 pts)
Write a program that takes in a user's zodiac sign and outputs a horoscope for the day.
Example:
- Enter your zodiac sign: Scorpio
- Your horoscope for the day: You will have a pleasant surprise today in your career.
------------------------------------
- Enter your zodiac sign: Gemini
- Your horoscope for the day: You may feel like you are in a rut today. Try doing something out of your comfort zone to break the monotony.
Steps:
1. Create a variable named `zodiacSign` and assign its value to a zodiac sign of your choice.
2. Create a switch statement that checks the value of the sign.
- For each case, write a horoscope message for that sign for the day.
- If the user enters a sign that is not recognized by the switch statement, display an error message saying "Sorry, we do not have a horoscope for that sign."
*Note: Check the file called "Zodiac_Signs.md" to find the list of horoscope messages.*
************************************************************************************************/
// TODO: ADD YOUR CODE BELOW
/************************************************************************************************
Task 6 (Switch Statement): (20 pts)
Create a program that helps you decide what to wear based on the weather forecast for the day.
Steps:
1. Create a variable named `weather` and assign its value to forecasted weather for the day (e.g. sunny, cloudy, rainy, snowy).
2. Create a switch statement that checks the value of weather.
- For each case, write a message recommending appropriate clothing for that weather condition.
- If the user enters a weather condition that is not recognized by the switch statement, display an error message saying "Sorry, we do not have recommendations for that weather condition."
Example:
- What's the weather forecast for today? Rainy
- Recommendations: Wear a waterproof jacket, boots, and bring an umbrella.
------------------------------------
- What's the weather forecast for today? Sunny
- Recommendations: Wear sunscreen, a hat, and sunglasses.
*Note: Check the file called "Clothing_Recommendations.md" to find the list of weather forecasts and their corresponding clothing recommendations.*
************************************************************************************************/
// TODO: ADD YOUR CODE BELOW