Seasons on Terra

  • 4
  • Locked
An Earth year consists of four seasons, each of which lasts 3 months. While our ship was parked on this cradle of humanity, the Interplanetary Tax Service asked us to write a program to determine the season based on a number corresponding to the month of the year. We don't know why they want it. They say that it's none of our business. But they promised not to remain in our debt.
You can't complete this task, because you're not signed in.
Comments (30)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 4
5 February, 02:11
I used if with the || (OR) logical operator in my solution, and it passed at the first try!
Level 8 , Santo Domingo, Dominican Republic
12 March, 17:18
Your hints are the best! Passed it at the first try too
Jomar Tayactac
Level 3 , Winnipeg, Canada
20 July 2021, 16:49
I went with if/else-if way of solving this one which I think the simplest way.
Usman Full Stack Developer at QA
24 June 2021, 12:44
if using the switch statetment, dont forget the
Karas Java Developer
25 August 2020, 00:10
Just make sure you go all the way with the switch though... all of them 1 to 12.
Level 17
17 August 2020, 04:14
When you don't get it on the first attempt because instead of putting autumn you put fall.
Level 19 , Newark, United States
29 July 2020, 18:50
I literally had to google conditional arguments because I only remembered the &&. When I mixed the || with the && I was able to output a correct answer in the console but the problem was still unresolved. Please help.
Level 41
31 July 2020, 05:59
Please post your question with the attached solution in the section Help.
Marek Pasierbek Working at Nexus Polska
10 June 2020, 09:20
use switch case
Level 17
17 August 2020, 04:16
That would be way more code for somthing so simple. Just use operators such as && and || Much easier since we know that numbers can be within a specific range. One thing I have learned is to always take shortcuts if possible, and you should always try to avoid repeating code. A switch case would be repeating a lot of code in this instance.
Usman Full Stack Developer at QA
24 June 2021, 12:48
I see whatt your saying about less code, however cleaner code > less more complex code. personally think switch looks cleanner and the better option here. and no, you dont have to repeat code with switch. you can have multiple cases with the just one typed output if you utilize break;
Laurence Chadwell
Level 7 , San Antonio, United States
20 August 2019, 02:28
I went out side of the box on this one.....didn't even use if else statements.
Level 41
5 September 2020, 11:02
oh shit you went full matrix. would you mind sharing in private? thanks!
Brandon Nicolle
Level 5 , Edmonton, Canada
17 August 2019, 21:18
My code doesn't work for some reason. i thought using the || operator would make it easier? why is my else if statement not showing?
Level 18 , Roosendaal, Netherlands
18 March 2020, 05:49
it does makes it easier ... use if and if else and but them in it corresponding to the months
Level 17
17 August 2020, 04:19
When checking a range you need to use the && operator because the || operator is basically saying that it can be either of the conditions. When you use the && operator it has to be both those conditions. Hopefully that makes sense.
Level 41
5 September 2020, 11:03
Exactly, the || is not necessary in this excercise.. just if, else if and &&. :)
Level 5 , Shymkent, Kazakhstan
18 June 2019, 14:03
Help guys can't resolve lust Requirements Please help