Question: Create a program in Java that reads in a 8-bit String, must be read in as such. Then convert that string of 1's and 0's

Create a program in Java that reads in a 8-bit String, must be read in as such. Then convert that string of 1's and 0's to decimal as if it were encoded using the following representations:

Unsigned

1's Complement

2's Complement

Q(4.4) (2's complement)

1 bit (sign) - 3 bits (exponent: use bias) - 4 bits (significand), implied binary point w/ 1. Also check for 0....

Do not use helper functions, must be done iterating string and modifying an int/long value.

Example Execution (Highlighting is showing the user input):

Enter a binary number: 10011010 
Unsigned: 154 1's Comp: -101 2's Comp: -102 Q(4.4): -6.375 S-Exp-Sig: -0.40625 
 

EDIT: It is a string of 1s and 0s which represents a binary number that needs to be entered and converted to decimal notation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!