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

 

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

Write a method that returns how many minutes remain until class starts, or returns 999 if the bell to exit your previous class has not rung yet. Variable doneBell is true if the bell to end the previous class already went off. Variable warningBell is true if the warning bell has also sounded. Integer timeSinceLastBell indicates how many minutes have elapsed since the last bell, measured in whole minutes. Keep in mind that after the "doneBell" rings you have 7 minutes to get to your next class, but after the "warningBell" rings you only have 2 minutes left. Look at the test data for examples. All of the input parameters will make sense. For example, the warningBell will never ring without the doneBell ringing first. Also the time since the last bell will always be accurate unless both doneBell and warningBell are false, in which case the time since the last bell is irrelevant since you will just return 999 no matter what.


classStartsDingRing1(true, true, 1) → 1
classStartsDingRing1(true, true, 2) → 0
classStartsDingRing1(true, false, 3) → 4

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

public int classStartsDingRing1(boolean doneBell, boolean warningBell, int timeSinceLastBell) { }

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

Copyright Nick Parlante 2017 - privacy