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

 

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

Wriet a method that is passed in three booleans which represent the state of binary digits. Return an integer representation of that binary number. For example, flagCode(true, true, false) returns a 6 because the binary number 110 in base 2 represents the decimal number 6. Recall that the first three digits in base 2 represent the 4's place, the 2's place, and the 1's place. So 110 means 4+2+0 which is 6.


flagCode(false, false, false) → 0
flagCode(false, false, true) → 1
flagCode(false, true, false) → 2

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

public int flagCode(boolean flag1, boolean flag2, boolean flag3) { }

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

Copyright Nick Parlante 2017 - privacy