edit-article
Home
Up
Delete
Article Name:
Article Description:
code-quiz-question - can we sleep in today?
Chapter ID/Name:
Status:
Write
Writing
Written
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">can we sleep in? </h1> <h2>[WHAT]</h2> <ol> <li>[] can we sleep in today? - determine if you can sleep in today based on the criteria defined in the where section below</li> <li>[] solutions are coded in java</li> </ol> <h2>[WHY]</h2> <ol> <li>[] practice, practice, practice </li> </ol> <h2>[WHERE]</h2> <ol> <li>[] <span style="display: inline !important; float: none; background-color: #ffffff; color: #000000; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 10px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">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.</span></li> </ol> <h2>[WHEN]</h2> <ol> <li>[] 2014-03-18</li> </ol> <h2>[EXAMPLE]</h2> <p><span style="font-size: medium;"> public boolean sleepIn(boolean weekday, boolean vacation) {</span><br /><span style="font-size: medium;"> if ( weekday != true && vacation ==true ){</span><br /><span style="font-size: medium;"> return true;</span><br /><span style="font-size: medium;"> } </span><br /><span style="font-size: medium;"> if (weekday !=true && vacation != true){</span><br /><span style="font-size: medium;"> return true;</span><br /><span style="font-size: medium;"> }</span></p> <p><span style="font-size: medium;"> if (weekday == true && vacation != true){</span><br /><span style="font-size: medium;"> return false;</span><br /><span style="font-size: medium;"> }</span><br /><span style="font-size: medium;"> if (weekday == true && vacation == true){</span><br /><span style="font-size: medium;"> return true;</span><br /><span style="font-size: medium;"> }</span></p> <p><span style="font-size: medium;"> return false;</span><br /><span style="font-size: medium;">}</span></p> <h2>[HOW-TO]</h2> <ol> <li>[x] the code in the above example section will execute in the editor at the source site listed below, it passes all tests</li> </ol> <h2>[REFERENCE]</h2> <ol> <li>] <span style="color: #000120;"><a href="https://codingbat.com/prob/p187868" target="_blank">https://codingbat.com/prob/p187868</a></span><span style="display: inline !important; float: none; background-color: #ffffff; color: #000000; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: 10px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"> - included in some 'easier coding tests' for 'getting warmed up' section</span></li> </ol>