Question: In this question you will construct a binary calculator equipped with the addition operator. For ease of understanding and writing, feel free to use Java

In this question you will construct a binary calculator equipped with the addition operator. For ease of understanding and writing, feel free to use Java syntax for loop structures and method structures. Assume you are given two binary integers in the form of boolean []s, where the first one is some a = boolean[n], of length n, the second is some b= boolean [m], of length m. You may assume that mn. In this representation, every entry is a boolean (we're in binary!) a[0] is the "least-significant-bit" (the "one's place"). your goal is to return their sum in binary (return it as a boolean[] as well, in the same format). For this problem you may only use the boolean operators ,, in finding the sum of these two binary integers. You are free to use java-like syntax (including java structures like loops) along with propositional logic notation. But you may not use any operator other than ,, to combine/alter the booleans. (for a greater challenge, limit yourself to only two of these operators, and consider why you cannot solve this task using only one of these operators). Hint: Consider breaking this problem down. First, consider the maximal possible size of the output array. Then, isolate a single "column" in the addition, and consider what information you need to find the corresponding output digit. Then, try adding small binary numbers by hand and seeing how you would construct these addition operations using only boolean operators. Good luck
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
