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

 

amjadm@miamioh.edu assignment3 > genNumber
prev  |  next  |  chance

Given 4 boolean values a, b, c, and d, each one has a corresponding number from 1 to 4. So a is 1, b is 2, c is 3, and d is 4. Create a number based on which variable is true and return the number. For instance: if only a, c, and d are true, the result of 134 needs to be returned.


genNumber(true, true, true, true) → 1234
genNumber(false, false, false, false) → 0
genNumber(true, true, false, true) → 124

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

public int genNumber(boolean a, boolean b, boolean c, boolean d) { }

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

Copyright Nick Parlante 2017 - privacy