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

  Describe the difference between noise and distortion how

question 1 what is the difference between noise and distortion? how can noise and distortion be introduced into a

  Compute and plot 4 mean temperature profiles

Compute and plot 4 mean temperature profiles (temperatures a function of the time of the day) for each of four-periods of one year in a single sub-figure (January-March; April-June; July-September; October-December).

  Write a method that returns the index of the second element

Write a method that returns the index of the second smallest element in an array of integers.

  Abc institute of research has sensitive information which

abc institute of research has sensitive information that needs to be protected from its rivals. the institute has

  Create an excel worksheet and chart

Create an Excel worksheet and chart as shown below. Save the worksheet with the name: Budget - your own name. The final product should contain the appropriate functions and formulas.

  Difference between encapsulation and information hiding

define the difference between encapsulation and information hiding. In addition, I need to explain the role both of these concepts play in helping to make designs more robust and extensible.

  Prove that the dfs tree is a spanning tree of g

(a) Prove that the DFS tree is a spanning tree of G. (b) Recall that the DFS algorithm arbitrarily chooses an unvisited neighbor.

  How to find the "smallest" and "largest" in a series of word

Write a program that finds the "Smallest" and "Largest" in a sequence of words. After user enter the words, the program will determine which words would come first and last if the words were listed in dictionary order.

  Write a paper describing the project in terms of its scope

Write a two-page paper describing the project in terms of its scope. time. and cost goals. Discuss what went right and wrong on the project.

  Write paper on managerial issues of a networked organization

Write a reseacrh paper about Managerial issues of a networked organization. Minimum six sources - at least two from peer reviewed journals.

  What information can be brought to bear

We do know that the client has an advertising plan and budget in place where in he is presently spending 5% on creation of ad and 95% on airing of the commercial. It has been seen that the quality of advertise designing is falling and not upto the..

  Discuss the various technical challenges everyone has posted

Discuss the various technical challenges / opportunities everyone has posted. Based on your discussion, choose the most important challenge for your Part 3.

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