Question: Write an interactive Java program to display the sum and the difference of two 8-bit strings which represent integers between -128 and +127 in the
Write an interactive Java program to display the sum and the difference of two 8-bit strings which represent integers between -128 and +127 in the twos complement number system.
Your program should read in the bit strings from the keyboard and store them as String variables in Java and display the outputs also as Strings.
Sample output:
Please enter the first 8-bit string> 11111111
Please enter the second 8-bit string> 00000001
The sum = 00000000The difference = 11111110
Your program must perform the arithmetic in binary in order to find the sum and the difference of the two input strings. You are allowed to represent the two input binary character strings in the form of binary arrays of integers (0s and 1s) inside your code in order to perform the arithmetic operations in binary. However, you must convert the results back into the string format before displaying them on the screen.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
