Day of the week

  • 4
  • Locked
Planet Terra still has "offices"—an outdated type of workspace. With current technology, there is no need for them, but earthlings tend to be nostalgic and haven't been in a hurry to eradicate them. Terrestrial office workers develop "TGIF syndrome": they constantly want to know what day of the week it is. Let's write a program for them!
You can't complete this task, because you're not signed in.
Comments (21)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 16 , London, United Kingdom
26 March, 12:36
Either [switch/case] or [if/else] statements are excellent. Indeed there are some differences between these two, but if you can complete the task with either then thumb up!
Level 8 , Moscow, Russian Federation
10 March, 14:51
Hi everyone) Why it's wrong? BufferedReader str = new BufferedReader(new InputStreamReader(; String daystr = str.readLine(); int daynum = Integer.parseInt(daystr); if (daynum = 1) ---> error: int cannot be converted to boolean
Level 41
12 March, 07:31
because the comparison is "=="
Level 4 , Baltimore, United States
28 January, 21:06
This question is outdated. Offices are so 2019 😋
M Till
Level 7 , San Jose, United States
24 July 2020, 22:07
try to switch up your thinking! ;) ;) ;)
Sean Nigito
Level 6 , Newark, United States
29 July 2020, 21:23
yeah a switch statement works really well
Level 7 , Lübeck, Deutschland
13 August 2020, 12:19
What is the switch statement?
Sean Nigito
Level 6 , Newark, United States
14 August 2020, 23:40
It is sort of like a chain of if else statements but looks for a specific input Here is a better explanation:
HaeWon Chung
Level 17 , Boston, United States
17 January 2020, 01:35
I was able to pass but I had to use
int a = Integer.parseInt(reader.readLine());
which I haven't learned it yet. Is there anyway to solve it without converting string into int? Or did I miss any lessons?
Level 31 , USA
31 October 2019, 15:29
Used a more advanced code, which we have not covered so far. Created a String array, to which I added "No such day of the week" and all of the days of the week in the correct order (i.e. 8 entries in total). Then used an if statement with a condition: if the entered day of the week is higher than 0 AND less than 8, then output the entry of the array which corresponds to the entered number by index (i.e. if you entered 2, then you will get "Tuesday"). Did not need any conditions in the else statement, just the output of the first index of the array (e.g. yourArray[0]), which means that the true output will be the "No such day of the week" text, which is assigned to the first index of the array.
Level 9 , Denver, United States
23 June 2019, 12:50
I used switch,, it works fine
shabarish kumar
Level 20 , Hyderabad, India
19 May 2019, 05:28
Are we not supposed to use Switch here!
Level 6 , pune, India
18 May 2019, 07:10
Error converting a string to a number (invalid format). everytime this error is there.What should I do?
Level 5 , Working from G1 1EJ, Glasgow UK., United Kingdom
6 May 2019, 12:03
I am running this exercises in the webpage, should I be doing each and everyone in the IDE by now?
Level 41 , Solar System
6 May 2019, 12:56
It's up to you really. However, you will find that the further you go in the course the more helpful IntellijIDEA will become. Plus, you will have to familiarize yourself with it at some point anyway. The big tasks available in the Collections/Multithreading quests will need to be completed in IntellijIDEA, for example.