Henas Cirtak

Greenhorn
+ Follow
since Oct 02, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Henas Cirtak

How do you convert a type double to an type Int?
19 years ago
Thank you I got it to work! Although, my book gives the example...

String stringValue = new String("147.82");
Double tempValue = Double.valueOf(stringValue);
double doubleValue = doubleValue(tempValue);

Am I just missing what the book is trying to teach or is it wrong?
19 years ago
How do I call the java.lang.Double class? I thought that it was automatically imported.
19 years ago
This is the error that I get...

C:\Documents and Settings\Patrick\My Documents\Java Programs\Chapter 6\CalcPay\CalcPay.java:31: cannot resolve symbol
symbol : method doubleValue (java.lang.Double)
location: class CalcPay
double text1double = doubleValue(text1Double);
^
C:\Documents and Settings\Patrick\My Documents\Java Programs\Chapter 6\CalcPay\CalcPay.java:32: cannot resolve symbol
symbol : method doubleValue (java.lang.Double)
location: class CalcPay
double text2double = doubleValue(text2Double);
^
2 errors

Tool completed with exit code 1
19 years ago
I'm trying to convert a String to a double value. My book says to first create a Double object and then convert the Double to a double value. It's not working... anybody got any ideas?

Thanks!


import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class CalcPay extends Applet implements ActionListener
{
TextField text1 = new TextField("hours worked",15);
TextField text2 = new TextField("hourly rate", 15);
Button button = new Button("Press Me");
Label label = new Label(" ");

public void init()
{
add(text1);
add(text2);
add(button);
add(label);
button.addActionListener(this);
invalidate();
validate();
}

public void actionPerformed(ActionEvent e)
{
String text1Number = text1.getText();
String text2Number = text2.getText();

Double text1Double = Double.valueOf(text1Number);
Double text2Double = Double.valueOf(text2Number);

double text1double = doubleValue(text1Double);
double text2double = doubleValue(text2Double);

}
}
19 years ago
You Rock!! Thank you!!!
19 years ago
OK... I'm seriously stuck. I can't seem to figure out how to convert an int to a String. I'm using the toString() method but can't seem to get it to work. What am I doing wrong???


import java.applet.*;
import java.awt.event.*;
import java.awt.*;

public class DoubleInteger extends Applet implements ActionListener
{
TextField info = new TextField(20);
Label answer = new Label("The Answer");
Button pressMe = new Button("Press Me");
int dInfo;
int doubleInfo;
String finalAnswer;


public void init()
{
add(info);
add(pressMe);
pressMe.addActionListener(this);
add(answer);
invalidate();
validate();

}

public void actionPerformed(ActionEvent e)
{
String x = info.getText();



int anInt = Integer.parseInt(x);
int theAnswer = anInt * 2;
System.out.println(theAnswer);

finalAnswer = theAnswer.toString();
answer.setText(finalAnswer);


}
}
19 years ago
Thanks Mike!! As far as I'm concerned you're already a great teacher now!! Appreciate the help and guidance!!
19 years ago
Thanks Mike... what do you mean by style rules? Do you have a Java job?
19 years ago
I'm trying to learn Java. I've always wanted to learn so I decided to go at it full time. My goal is to be a professional Java Programmer someday... which I asume many on this site are. So my question is how did people turn Java Pros? I am currently half way done with my Java Diploma from Education Direct. It's an online program. I don't recommend it because you get "0" feedback from the instructors. Anyway how'd you guys get so good a Java. Thanks in advance... Patrick
19 years ago