Menu

(Solved) : Write Program Java Prompts User 8 Bit Byte Binary Number Converts Decimal Number Binary Co Q44006539 . . .

Write a program (Java) that prompts the user for an 8bit (a byte) binary number and converts that into a decimal number.For binary conversion, look at each of the digit’s values,multiplied by their position, and sum those together to get theresulting value.

Objective: Write a program that prompts the user for an 8 bit (a byte) binary number and converts that into a decimal number.

Objective: Write a program that prompts the user for an 8 bit (a byte) binary number and converts that into a decimal number. For binary conversion, look at each of the digit’s values, multiplied by theit position, and sum those together to get the resulting value. Let’s take the byte 01011001 and convert it into a decimal value. Binary Digit 0 1 0 1 1 0 0 1 Base 2 Representation 27 26 25 24 23 22 21 20 at this position Decimal Value 1 128 64 32 16 I 8 4 at this position 2 1 Multiplying each binary digit by the decimal values and summing them you get 0*128+1*64+0*32+1*16+1*8+0*4+0+2+1*1 = 89 Assume the user will only input either 0 or 1 without having the check. Also built in Java methods that does this conversion automatically (such as Integer.parseInt(String.2)) WILL NOT be accepted. However, you may still use Integer.parseInt(String) to convert from a String to an integer. Example Dialog: Enter an 8 bit binary number and I will convert it to decimal 01011001 01011001 in decimal form is 89 Finally: Upload the java file to the dropbox Show transcribed image text Objective: Write a program that prompts the user for an 8 bit (a byte) binary number and converts that into a decimal number. For binary conversion, look at each of the digit’s values, multiplied by theit position, and sum those together to get the resulting value. Let’s take the byte 01011001 and convert it into a decimal value. Binary Digit 0 1 0 1 1 0 0 1 Base 2 Representation 27 26 25 24 23 22 21 20 at this position Decimal Value 1 128 64 32 16 I 8 4 at this position 2 1 Multiplying each binary digit by the decimal values and summing them you get 0*128+1*64+0*32+1*16+1*8+0*4+0+2+1*1 = 89 Assume the user will only input either 0 or 1 without having the check. Also built in Java methods that does this conversion automatically (such as Integer.parseInt(String.2)) WILL NOT be accepted. However, you may still use Integer.parseInt(String) to convert from a String to an integer. Example Dialog: Enter an 8 bit binary number and I will convert it to decimal 01011001 01011001 in decimal form is 89 Finally: Upload the java file to the dropbox

Expert Answer


Answer to Write a program (Java) that prompts the user for an 8 bit (a byte) binary number and converts that into a decimal number…

OR