Java 我需要帮助找出我的代码有什么问题
我得到一些错误,说它找不到符号Java 我需要帮助找出我的代码有什么问题,java,error-handling,Java,Error Handling,我得到一些错误,说它找不到符号 import javax.swing.JOptionPane; public class ShippingSales { public static void main (String [] args) { int weight, miles; String temp; double shippingcharge, rate; shippingcharge = miles * rate; miles = 50
import javax.swing.JOptionPane;
public class ShippingSales
{
public static void main (String [] args)
{
int weight, miles;
String temp;
double shippingcharge, rate;
shippingcharge = miles * rate;
miles = 500;
temp = JOptionPane.showInputDialog("Enter the weight of the package");
weight = Interger.parseInt(temp);
if (weight <= 2)
{
JOptionPane.showMessageDialog(null, "Your total amount is " + shipppingcharge);
rate = 1.10;
}
if (weight > 2 && weight<= 6 )
{
JOptionPane.showMessageDialog(null, "Your total amount is " + shipppingcharge);
rate = 2.20;
}
if (weight > 6 && weight<= 10)
{
JOptionPane.showMessageDialog(null, "Your total amount is " + shipppingcharge);
rate = 3.70;
}
if (weight > 10)
{
JOptionPane.showMessageDialog(null, "Your total amount is " + shipppingcharge);
rate = 3.80;
}
}
}
这条线有什么不对劲吗
提示:拼写
此外,您在变量引用中多次拼写错误shipping charge。您在所有ShowMessage对话框中都使用了三个p,但该变量称为shippingcharge
你拼错了整数,你用的是整数哪些符号?如果编译器说找不到ShippingCharge。你只需要检查一下拼写是否正确——事实并非如此。INTEGER也是这样。
Interger.parseInt(temp);