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

 

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

Write a method that accepts two 4-bit binary numbers, each in the form of a boolean array. For example, 1011 would be represented by {true, false, true, true}. Your method should use a helper method that emulates the one-bit binary adder using only logic operators. The resulting method may not use any addition, subtraction, multiplication, or division. It must accomplish 4-bit binary adding using only logic operators! The method returns a 5-bit binary number in the form of a boolean array where the most-significant bit (bit 0) represents the final carry bit.


fourBitAdder([true, true, false, false], [false, false, true, true]) → [false, true, true, true, true]
fourBitAdder([true, false, false, true], [true, false, false, true]) → [true, false, false, true, false]
fourBitAdder([true, true, false, true], [true, true, true, true]) → [true, true, true, false, false]

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

public boolean[] fourBitAdder(boolean[] num1, boolean[] num2) { }

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