article

can we sleep in? 

[WHAT]

  1. [] can we sleep in today? -  determine if you can sleep in today based on the criteria defined in the where section below
  2. [] solutions are coded in java

[WHY]

  1. [] practice, practice, practice 

[WHERE]

  1. [] The parameter weekday is true if it is a weekday, and the parameter vacation is true if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return true if we sleep in.

[WHEN]

  1. [] 2014-03-18

[EXAMPLE]

 public boolean sleepIn(boolean weekday, boolean vacation) {
  if ( weekday != true && vacation ==true ){
     return true;
  }
  if (weekday !=true && vacation != true){
     return true;
  }

  if (weekday == true && vacation != true){
     return false;
  }
  if (weekday == true && vacation == true){
     return true;
  }

    return false;
}

[HOW-TO]

  1. [x] the code in the above example section will execute in the editor at the source site listed below, it passes all tests

[REFERENCE]

  1. https://codingbat.com/prob/p187868 - included in some 'easier coding tests' for 'getting warmed up' section
Details Photos Edit more

Details

ID: 2587

NAME: code-quiz-question

DESCRIPTION: code-quiz-question - can we sleep in today?

AUTHOR: article.author/s

EDITOR: article.editor/s

PUBLISHER: article.publisher/s

STATUS: Write

PRIORITY: -5

OWNER ID: 75

Content Photos Edit more

photos

page_photo

actions

Email Email-Owner SMS and