Question: in java Bin ToDec: Write a program that prompts the user to enter a 4-digit binary number (String type, not int type). The program then
Bin ToDec: Write a program that prompts the user to enter a 4-digit binary number (String type, not int type). The program then converts it to equivalent decimal number and displays the result. Here is a sample run: Enter a 4-digit binary number: 1110 1110 (in binary) = 14 (in decimal) Hint: If a, b, c, d are the bits representing the 4-bit binary number abcd, then the decimal equivalent is 8 * a +4* b +2*c+1* d. Use a wrapper class and String method(s) to extract each bit of the binary number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
