可以帮我看一个小applet吗?
import java.awt.Graphics ;import javax.swing.JApplet ;
import javax.swing.JOptionPane;
public class Float extends JApplet{
public void paint(Graphics g)
{
String firstNumber;
String secondNumber;
String thirdNumber;
float first;
float second;
float third;
float sum,average,mul,max,min;
firstNumber = JOptionPane.showInputDialog("Enter first number");
secondNumber = JOptionPane.showInputDialog("Enter second number");
thirdNumber = JOptionPane.showInputDialog("Enter third number");
// number1 = Integer.parseInt(firstNumber);//把String转换成int
first = Float.parseFloat(firstNumber);
second = Float.parseFloat(secondNumber);
third = Float.parseFloat(thirdNumber);
sum = first + second + third;
average = sum/3;
if((second>first)&&(second>third)) max = second ;
else if((second>first)&&(second<third)) max = third ;
else max = first ;
if((second<first)&&(second<third)) min = second ;
else if((second<first)&&(second>third)) min = third ;
else min = first ;
mul = first * second * third ;
JOptionPane.showMessageDialog(null,"max = " + max ,"\nmin = "+ min "\naverage = "+average "\nmul = "+ mul,"VC++.NET",JOptionPane.PLAIN_MESSAGE);
System.exit(0);
}
}
//firstNumber = JOptionPane.showInputDialog("Enter first number"); 编译器指示这里出错
// number1 = Integer.parseInt(firstNumber);//把String转换成int //这是书上的对的例子
[此贴子已经被作者于2005-9-19 9:45:08编辑过]