Write a program that reads a 4-bit binary number from the


Write a program that reads a 4-bit binary number from the keyboard as a string and then converts it into decimal. For example, if the input is 1100, theoutput should be 12. (Hint: Break the string into substrings and then convert each substring to a value for a single bit . If the bits are b0, b1, b2, and b3, the decimal equivalent is 8b0+ 4b1+ 2b2+ b3.)

Input Notes: Just a 4-bit string , like 1101 or 0010.

Output Notes (Prompts and Labels): The input is prompted for by:

Enter a four bit binary value .

After input, the program prints out a line of this form:

The value of BBBB is D

where BBBB is the binary string entered and D is the calculated decimal equivalent.

SPECIFICATION OF NAMES: Your application class should be called FromBinary.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write a program that reads a 4-bit binary number from the
Reference No:- TGS01260640

Expected delivery within 24 Hours