Question: Write a Java ) program, call it binaryArithmetic with the following requirements: the programs take 3 space - separated string arguments, i . e .

Write a Java) program, call it binaryArithmetic with the following requirements:
the programs take 3 space-separated string arguments, i.e., a binary number, an operator (+ or -) and a binary number.
the program parse each of the three argument and, in case any of them is not valid, prints an error message and exits. This parsing of binary numbers should be done in a separate function, called int parse(char *).
If the operator is -, the second binary number is transformed into its corresponding 2's complement. This operation should be done in a separate function, called void get2Complement(char **.
The addition of the two binary strings is performed in another function called void Add(char *num1, char *num2, char *result)
Finally, your program should print the result in the following format: num1 op num2= result, e.g.,01000001+00000011=01000100
For simplicity, assume you are dealing with 8-bit signed numbers in the range of -128-+127.
Test runs:
$ binaryArithmetic // call without arguments
$ Usage: binaryArithmetic Binary 1>+ Binary 2>
$ binaryArithmetic 01000010+00000011
$01000010+00000011=01000101
$ binaryArithmetic 01009010+00000011
$ Illegal character in binary string.
Please do in java only .
 Write a Java) program, call it binaryArithmetic with the following requirements:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!