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

 

dsawyer@methacton.org intro_p4_level_2 > randomProblem1
prev  |  next  |  chance

If the given boolean parameter is true, and the integer parameter is positive, return the square root of the integer (rounded toward zero). If the given boolean parameter is true, and the integer parameter is negative or zero, return the absolute value of the parameter times two. If the boolean parameter is false, return zero (if doesn't matter what the integer parameter is).


randomProblem1(true, 144) → 12
randomProblem1(true, -7) → 14
randomProblem1(false, 100) → 0

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

public int randomProblem1( boolean b, int num ){ }

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