about | help | code help+videos | done | prefs |
Write a method that returns a string indicating the day of the week and if it gets to count as a weekend or not. The day of the week is indicated by 'num' with 1 being Monday and 7 being Sunday. The boolean parameter 'working' indicates if you are having a working weekend or not. If 'working' is true, it means you must work that weekend, so Saturday and Sunday do not really count as the weekend for you. Look at the test data for examples. PLEASE do NOT go crazy with switch-case or conditional statements. I did this with ONE ternary conditional and ONE 'if' statement (with no 'else'). I'm not saying you have to be THAT sparse about it... but THINK FIRST. Don't just write 14 conditionals!!!! test2021_04_29_APP1SLHL_day(4, false) → "Thursday" test2021_04_29_APP1SLHL_day(4, true) → "Thursday" test2021_04_29_APP1SLHL_day(2, false) → "Tuesday" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy