我是新编码和课程,我需要双十进制格式的代码,但我收到错误
对于参数类型,未定义operator /,String,int"
代码:
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
public class input
{
public static void main(String[] args)
{
DecimalFormat formatter = new DecimalFormat("#0.00");
int distance = Integer.parseInt(JOptionPane.showInputDialog("How far did you travel?"));
int time = Integer.parseInt(JOptionPane.showInputDialog("How long did it take? (In Hours)"));
System.out.println(formatter.format(distance) / time);
// The line in question ^^^^^
}
}