I tried to go into the chat room, but even though I have the most
recent VM from microsoft, the chat applet won't load. (sigh) I'm
not even sure there is anyone there.
Anyway.
I am taking a Java class, and am having trouble. I'm running a
student evaluation version of MS Visual J++ 6.0 and getting
a "Cannot convert 'Double' to 'double'" error with the code listed
below. BTW, using parseDouble instead of valueOf gets me a method
not found error. can anyone help me? Thanks in advance.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class CalcPay extends Applet implements ActionListener
{
Label hours = new Label("Enter Hours worked:");
Label rate = new Label("Enter Hourly Rate:");
TextField hoursWorked = new TextField("",10);
TextField ratePaid = new TextField("",10);
Font labelFont = new Font("Arial", Font.PLAIN,12);
Button Calc = new Button("Calculate");
public void init()
{
hours.setFont(labelFont);
rate.setFont(labelFont);
add(hours);
add(hoursWorked);
add(rate);
add(ratePaid);
add(Calc);
Calc.addActionListener(this);
ratePaid.addActionListener(this);
hoursWorked.requestFocus();
}
public void actionPerformed(ActionEvent thisEvent)
{
double dbl_hw, dbl_rp, pay;
String hw = hoursWorked.getText();
String rp = ratePaid.getText();
dbl_hw = Double.valueOf(hw);
dbl_rp = Double.valueOf(rp);
pay = dbl_hw * dbl_rp;
Label calcInfo = new Label("");
calcInfo.setText("Gross Pay is $" + pay);
add(calcInfo);
}
}