Easy there, pal!
To access the Conditions challenges in the JavaScript programming, you need to sign up and subscribe first.
The next program that you will write will calculate the duration of the walk depending on weather conditions and air temperature with the aim of achieving the most effective metabolism in the body of a cat.
Meow! The length of the walk depends on several conditions.
If it’s raining, I do not go for a walk. In this case, the duration of the walk equals
0. But if there is no rain, it all depends on the temperature outside:First, if the temperature ranges from 10°C (inclusive) to 15°C (not including this value), I walk for 30 minutes. A little cold, but the fur coat is helping.
Secondly, if the temperature ranges from 15°C (inclusive) to 25°C (not including the value), I walk for 40 minutes: the weather is perfect.
Thirdly, if the temperature ranges from 25°C (inclusive) to 35°C (inclusive), I walk for 20 minutes: my paws get too sweaty in such heat.
In other cases, I do not go out anywhere: it’s either very cold or very hot. I feel great at home on top of the radiator.
The isRaining variable stores an indicator (it is called a “flag”), which indicates if it is raining. If the value of the variable is true, it rains outside, if it is false there is no rain. Variable temperature shows the temperature outside. The result of the program is the time of the walk. It must be written into the variable minutes.
This is an unusual task. In it, the boss will test your program, substituting different values in the input variables and checking the received recommendations. Only when all tests are successfully passed, the task will be complete.
To call the Muffin to check the program, press the Hey boss, here’s your program! button located in the console.
You’ve gone to a different page
Click inside the mini-browser to shift the focus onto this window.
To access the Conditions challenges in the JavaScript programming, you need to sign up and subscribe first.
Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.
Forgot to connect your email to the profile? Email us and we’ll help.