Question: Task Description: As a programmer, you want to create a java program that you can convert a binary string into a decimal and hexadecimal value.
Task Description: As a programmer, you want to create a java program that you can convert a binary string into a decimal and hexadecimal value. A binary string is a base value of s and s eg A decimal value is a base integer value of the binary stringeg Finally, a hexadecimal value is which follows a base of egB It should follow that a nonbinary string cannot be converted from binary to decimal and hexadecimal values.
To get a decimal value, you add up all the binary digits of times the power of at their positions.
Example:
To get a hexadecimal value, you split a binary string into groups of binary strings of size four starting from the right. If the binary string does not evenly split into groups of four, then Os should be added to the left of the binary string to until it can be split evenly. Then convert the individual strings to decimal values. If the decimal value is then the hex value is AF accordingly.
Example:
;
;
After you have written the program in Notepadwindows TextEditMac or text editors in Linux such as vim, emacs, or nano. Run the "javac" command refer to the presentation if you do not remember to create the java class files. Test if your java classes executes with the "java" command. Once you have successfully completed your program create an executable jar file. To accomplish this use the following command in the console:
jar cvfe BinaryConverter.jar Main class Where BinaryConverter.jar is the name of jar file and Main is the name of the class containing mainString args
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
