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

 

abraskin@mbusd.org > jakeSleep
prev  |  next  |  chance

When Jake is not busy he will get 12 hours of sleep. Unfortunately, Jake has a lot of stuff to do on a given night. When he hangs out with friends he loses 2 hours of sleep. When he does college applications, he loses 3 hours of sleep. When he writes codingbat problems, he loses 7 hours of sleep. When he studies for tests, he loses 4 hours of sleep. Because he is not a time traveller, Jake cannot get negative sleep. The least amount of sleep he can get is 0 hours. Return the number of hours that Jake slept last night.


jakeSleep(false, false, false, false) → 12
jakeSleep(true, false, false, true) → 6
jakeSleep(false, true, true, true) → 0

...Save, Compile, Run (ctrl-enter)

public int jakeSleep(boolean friends, boolean app, boolean wroteCodingbat, boolean study){ }

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: 100

Copyright Nick Parlante 2017 - privacy