我收到一些错误,说找不到符号
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;
}
}
}
答案 0 :(得分:0)
Interger.parseInt(temp);
第二眼你能看到这条线路有什么问题吗?
提示:拼写。
此外,您多次在变量引用中拼错了“运费”。
答案 1 :(得分:0)
你在所有showMessageDialogs中使用了三个“p”,但变量名为shippingcharge
你拼错了Integer
错误,你使用了Interger