I am working with a java program that uses binary and sequential search. i have those two methods working. In the program i also need to return the price of parallel arrays. This is my code so far:inventory class:
//FileName: InventoryData.java
//Prog: Brock Paston
//Purp: To load and search through arrays with binary and sequnetial search.
package stu.paston.program6;
I'm having some trouble with a code I am writing for class. I had an 2 errors like this before this one and fixed it by changing int avgRe, avgMiles =0; to double. Now I am getting this error and am stuck on what I need to change. Here is the code:
import java.io.*; import java.util.*; import java.text.*; public class Reimbursement_3_09 { static Toolkit tools = new Toolkit(); public static void main (String [] args) throws Exception {
[Code] ....
This is my error:
[code=Java] Reimbursement_3_09.java:33: error: incompatible types: possible lossy conversion from double to int summary (outFile, totalAmount, ctrMiles, ctrMilesgt0, avgRe, avgMiles); ^ Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
I am trying to convert the double 4270571936.0000000000d to a hex string using Double.toHexString() and the answer I'm getting is 0x1.fd17834p31, what does p stands for?
The answer I'm expecting to get is 0x41efd17834000000 so not sure why it won't give me the correct answer?
The following floating point Double to hex calculator shows the write answer right Floating Point to Hex Converter
I have a char[] containing ASCII characters that need to be converted into int value and double value.
The int value are always stored in 1 char size like 'j'. I extracted it succesffully by converting the char in a ascii bytearray and then used: Integer.parseInt(sb.toString().replace("0x", ""), 16);
How can I get the Value as double when i used the char[] with size 2 or 4 ?
Example : final char[] charValue = { 'u', ' ', '}','+' }; what is the associate Double value ?
Example : final char[] charValue = { 'T', ' ' }; what is the associate Double value ?
Example : final char[] charValue = { 'T', ' ' }; what is the associate int value ?
I'm working on a Weight Conversion program. The code I have for the program is:
import java.util.*; import java.awt.*; import javax.swing.*; public class Frame4a implements ActionListener { public static void main(String[] args) { JFrame f = new JFrame("Weight converter"); JPanel P = new JPanel(); // Make a JPanel;
[Code] .....
The errors I'm getting are:
Frame4a.java:33: error: class, interface, or enum expected public void actionPerformed(ActionEvent e){ ^ Frame4a.java:37: error: class, interface, or enum expected double kp= Double.parseDouble(strkilo);
So, here is the question I have been working on: Write a java class named Time that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (For example the elapsed time is 9630 seconds, and then the output is 2:40:30 ).Hint: an hour has 3600 seconds and a minute has 60 seconds. Use Scanner class for reading the input.
Here is my code:
import java.util.Scanner; public class Time { public static void main(String[] args) { Scanner scan= new Scanner(System.in); System.out.println("Enter the elapsed time in seconds:"); int totalseconds= scan.nextInt();
[Code] .....
Now, I know I am supposed to use the remainder operator to figure out the time in minutes and seconds, but the hours has be a little confused. Right now this code compiles but gives me an exception.
So i need to write a program that prompts the user for 3 double numbers x, y, z that outputs 2x^3 + 3y^5 + 3x^3y^2 +xyz with
(1) 4 digits precision (2) with a ',' to separate thousands (3) all digits of the result including the precision are put to 20 positions (from right to left)
I am not really sure what it is suppose to look like or how to start it.how to mix Math.pow with multivariable and printf.
So I need to make a for loop for this problem: A certain type of bacteria doubles its population every twelve hours. If you start with a population of 1000, how many hours will it take for the population to exceed 1,000,000? Output needs to be in table format, such as:
I am coding for the first time using the simplified BlueJ platform. I am trying to write a simple conversion program from cm to inches and inches to cm.
Here is my code so far (I also have the textIO file linked to it):
public class UnitConverter { public static void main(String[] args){ int inchesTocentimetres, centimetresToinches, exitApplication; int choice; double result;
When I try to convert this value, "Testingu2120" (along with UTF coed u2120)comes as a string as part of SOAP response. I need to convert this UTF-8 characters in to a symbol, in this case it is SM (Service Mark) symbol and show it on the UI.
How can we achieve this in JAVA?
I have four different UTF-8 character set to convert.
I need to convert the LDIF data file to CSV format using Java. IS there any supporting JAR's, which we can use for the LDIF data file reading and parsing. Which is the best jar to use.
final ServerSocket serverSocketConn = new ServerSocket(9000); while (true) { try { Socket socketConn1 = serverSocketConn.accept(); new Thread(new ConnectionHandler(socketConn1)).start();
[Code] .....
I managed to convert this final DatagramSocket serverSocketConn = new DatagramSocket (9000);
Now I am stuck here
Socket socketConn1 = serverSocketConn.accept(); new Thread(new ConnectionHandler(socketConn1)).start();
Can I use this or I need to create a manual thread pooling for UDP ?
Case study : infix to postfix conversion, i don't really know how i could make codes, I can understand what is the meaning of infix and postfix but when it comes of making codes i really have a hard time with it.
but when I put this second line, the conversion, the program stops to work. I tried also with Integer.valueOf(timeInterval) but again I had the same problem.
why i cant get the return value to my conversion class.
import java.util.*; /* * * public class MetricTest { public static void main(String[] args) { Scanner input = new Scanner(System.in); // declare a sentinal to exit the loop String check = "Quit";
If I don't append the L, is the msb (most significant bit) somehow still carried over to the resulting long variable and in the latter case, where I append an L, it is not and instead the value is filled up with 32 leading zeros (4 Byte difference between int and long)?
I'm having trouble getting the text entered in my JTextField to be converted to the conversion formula. The line I'm getting error in is:
String text = text.getText();
Also I created another JTextField in which I want the answer to be displayed in, but I'm not too sure how to go about that. This is my attempt at it, but it doesn't work because it doesn't make sense; result.setText1(Integer.toString(celsius));
import java.awt.*; import javax.swing.*; import java.awt.event.*; public class TempConversion extends JFrame { private final JLabel ask; private final JLabel result; private final JTextField text; private final JTextField text1;