Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 spaceseparated string arguments, ie 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 parsechar
If the operator is the second binary number is transformed into its corresponding s complement. This operation should be done in a separate function, called void getComplementchar
The addition of the two binary strings is performed in another function called void Addchar num char num char result
Finally, your program should print the result in the following format: num op num result, eg
For simplicity, assume you are dealing with bit signed numbers in the range of
Test runs:
$ binaryArithmetic call without arguments
$ Usage: binaryArithmetic Binary Binary
$ binaryArithmetic
$
$ binaryArithmetic
$ Illegal character in binary string.
Please do in java only
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started