id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2021_04_29_APP1SLHL_day
prev  |  next  |  chance

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)

public String test2021_04_29_APP1SLHL_day(int num, boolean working) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 250

Copyright Nick Parlante 2017 - privacy