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

 

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

Write a method that returns the maximum number of hours you should spend rock climbing today. The amount of time you spend rock climbing depends on several things. If you have been injured, you should climb a maximum of one hour, no matter what. Otherwise, you could climb up to one hour plus the number of days since you last climbed, but not to exceed 6 hours. However, if your pain level is low (below a 4), you can climb one extra hour. If you pain level is very high (above a 7), you can climb one less hours. Look at the test data for examples.


feb13_2020_APP1SLHL_rockClimbing(5, 3, false) → 7
feb13_2020_APP1SLHL_rockClimbing(5, 2, false) → 7
feb13_2020_APP1SLHL_rockClimbing(14, 9, false) → 5

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

public int feb13_2020_APP1SLHL_rockClimbing(int daysSinceLastClimb, int painLevel, boolean injured) { }

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

Copyright Nick Parlante 2017 - privacy