我有以下代码:
import java.util.Scanner;
import javax.swing.JOptionPane;
public class weatherCalc {
public static void main(String args[]) {
while (true) {
int division = 8125/1000;
Scanner in = new Scanner;
System.out.println("How far, in inches, is it moving on a 50-mile = 0.75 in? (Please use decimels)");
int weatherInput = in.nextInt();
System.out.println("How long is the time period in hours? (Please use decimels)");
int weatherTime = in.nextInt();
int weatherOutput = weatherInput/division*50/weatherTime;
System.out.println("The storm is travling at "+ weatherOutput +"MPH.");
}
}
}
你看,系统在 "System.out.println("它在 50 英里 = 0.75 英寸上移动了多远,以英寸为单位?(请使用小数)");" 带有红色下划线以及“Scanner in = new Scanner;”的结尾 我不知道为什么,我只是想为自己开发这个。我以后可能会做一些工作。如果有人能告诉我为什么,那将有很大帮助。