Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please read this and see what I need I have asked this question 4 times now and

ID: 2246927 • Letter: P

Question

please read this and see what I need I have asked this question 4 times now and no one is reading IT! Please it is what I need for my assignment.

I need to use JOption panes for input and output and similar to this code below should be used :

sign=(inputString.CharAt(0)=='0'?1:-1);

String expString=inputString,substring(1,8);

String mainString=inputSting.substring(9)

Write a program in JAVA to read in a 32-bit pattern and translate to a IEEE-754 floating point number. Do not use library routines. Be sure to look for infinity, -infinity, zero and NaN patterns.


Relatively new to coding, so the simpler the better. That way I understand what I am doing , thanks

Explanation / Answer

public class Sample

{

//convert 32 bit binary into decimal

private static float GetFloat32(String Binary)

{

Int intBits=Integer.parseInt(Binary,2);

Float Floating=Float.intBitsToFloat(intBits);

Return Floting;

}

//Get 32 bit IEEE 754 format o fdecimal value

private static String GetBinary32(float value)

{

int intBits=Float.floatToIntBits(value);

String binary=Integer.toBinaryString(intBits);

Return Binary;

}

Public static void main(String args[])

{

//convert 13.5 into IEEE 754 binary format

String s1=GetBinary32((float)13.5);

System.out.println(“binary equivalent of 13.5:”);

System.out.println(s1);

Float f11=GetFloat32(f11);

System.out.println(+f11);                           

System.out.println(f11);}}