+ 1

Hello I have to do an exercise and something goes wrong. Here I put it and if someone could help me.

Create a function that gets a number as a parameter which represents a day of week. implement the function using switch for cases 1 - 5 : print -> "Working day"; for cases 6 - 7 : print -> "No work"; for case 7 (only) also print -> "Holy Sabatt"; for any other -> print some error...

13th Dec 2017, 6:24 AM
fer zang
fer zang - avatar
11 Respostas
+ 3
Make the code public on the code playground then we might help
13th Dec 2017, 7:02 AM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
Can you post your incorrect code so we can try to fix it?
13th Dec 2017, 6:26 AM
blackcat1111
blackcat1111 - avatar
+ 1
I post. You can see?
13th Dec 2017, 6:35 AM
fer zang
fer zang - avatar
+ 1
Yes, you should do what @Brains said and also attach your code to your question or your reply so it is more convenient for us to help you. 😉 (In case you didn't know, attach your code by pressing the [+ Insert...] button and press [Insert Code], then select your code.)
13th Dec 2017, 7:18 AM
blackcat1111
blackcat1111 - avatar
+ 1
hi @John Wells thank you very much for answering and helping me. I understood my mistake.
13th Dec 2017, 11:03 AM
fer zang
fer zang - avatar
0
https://code.sololearn.com/WcnX98jHK3yH thanks for answering here is the link to my code
13th Dec 2017, 8:02 AM
fer zang
fer zang - avatar
- 1
You are missing { and } for the function. You might also add a call to test it.
13th Dec 2017, 10:28 AM
John Wells
John Wells - avatar
- 1
You used control instead of console 3 times. You have case for 7 twice. case 6 is missing break so will also output default message.
13th Dec 2017, 10:35 AM
John Wells
John Wells - avatar
- 1
put case 7 before case 6 without break so it prints both messages
13th Dec 2017, 10:40 AM
John Wells
John Wells - avatar
13th Dec 2017, 10:52 AM
John Wells
John Wells - avatar
- 1
If you wish to reverse messages for 7, put both cases back together and use if to output the 7 only message.
13th Dec 2017, 10:56 AM
John Wells
John Wells - avatar