Write a program in java to read in a 32-bit pattern

Assignment Help Computer Engineering
Reference no: EM132210224

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. ?( This is what I NEED, My SPECIFIED NEED is please use the import: import javax.swing.JOptionPane; for the input and output, a string to turn the int to binary,then a loop to check and see if there are any special patterns, example: NaN, -infinity, infinity, ect... If not check it with something like this ..............

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

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

?String mainString=inputSting.substring(9)

?Code below am having issues with!! AH please help thank you

import javax.swing.JOptionPane;
public class IEEE_754_2 {
public static void main(String[] args) {
String inputString,ieee_754;
inputString = JOptionPane.showInputDialog("Enter the 32bit number");
int sign=(inputString.charAt(0)=='0'?1:-1);
String expString=inputString.substring(1,9);
String mainString=inputString.substring(9);

int intExp = Integer.parseInt(expString, 2);

intExp = intExp -127;
int decimal_part=0;
double fraction =0.0;
for(int index=0; index <mainString.length();index++){
fraction = fraction + Integer.parseInt(""+mainString.charAt(index))*Math.pow(2,-1*(index+1));
}
ieee_754=""+(fraction+1)*sign*Math.pow(2,intExp);
JOptionPane.showMessageDialog(null,ieee_754);
}
}

Reference no: EM132210224

Questions Cloud

Implement the three disk-arm scheduling algorithms : Write a program to implement the three disk-arm scheduling algorithms. Write a driver program that generates a sequence of cylinder numbers .
Which of the four traps facing established firms : Which of the four traps (listed below) facing established firms do you see as the most prevalent and why?
Write a program in java to count the occurrences of word : Write a program in Java to count the occurrences of each word in a large text file (like a book)
Denver health operates with a private cloud and thin clients : Privacy laws and regulations require medical facilities to take measurable steps to ensure the confidentiality of patient information.
Write a program in java to read in a 32-bit pattern : 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.
Write a program to implement a set class along with member : Write a program to implement a "set" class along with member functions for union, intersection, difference, symmetric difference, and a test for subsets.
Economy present to firms operating in formal economy : What opportunities does the informal economy present to firms operating in the formal economy?
Benefits and drawbacks of licensing the similar system : What are the benefits and drawbacks of licensing the similar system offered by the IT solutions company?
Transportation and distribution functions : Discuss how sustainability can be achieved in transportation and distribution functions.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Find out the number of times a string is present

How to use Java classes to find out the number of times a string is present in another string.

  Why it is critical to developing good software

Using the parts of a house as an analogy, which stage of the program development cycle is the foundation.

  What must the inventory of the store be in order to conclude

What must the inventory of the store be in order to conclude that there at least 10 shirts in one of the three colors?

  Explain the costs involved in the creation of the system

Describe the types of business needs that can be addressed using information technology-based solutions.

  The chief executive has some sympathy with the notion that

woolsmorth is a large retail company specializing in groceries and clothing. it was founded in 1995 and currently has

  What could be improved

The three A's of security are Authentication, Authorization, and Auditing. Write a 1-2 page paper in APA format describing these techniques.

  Develop a complete disaster recovery plan

Using an organization of your choice: Develop a Complete Disaster Recovery Plan to be submitted to the executive board of your company.

  Write a program that computes the amount of money

Write a program that computes the amount of money the computer club will receive from the proceeds of their granola project. Each case has 100 bars.

  Create a visual logic file to execute the task

Create a Visual Logic file to execute the task. Obtain approval from your instructor for your chosen task. Send a Private Message to your instructor.

  Describe an implementation of the methods of a binary tree

Describe an implementation of the methods of a binary tree with this data structure and analyze the time complexity for these methods.

  Write a markup document to provide a form that collect names

Write a markup document to provide a form that collects names and telephone numbers. The phone numbers must be in the format ddd-ddddddd.

  Validate the email address and return true if valid

Create a new document called l5p3 html. It should have a form with a text input box for an email address and a Submit button.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd