我正在为飓风规模创建一个程序,它给我带来了问题。所有错误都发生在 else if 行上。帮助将不胜感激。这是代码:
import java.util.Scanner;
public class hurricaneScale {
public static void main(String[]args) {
Scanner in = new Scanner(System.in);
System.out.print("Please enter the wind speed (in mph):");
double windSpeed = in.nextln();
if (windSpeed < 39) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Tropical Depression < 39 mph - Minimal ");
}
else if (windSpeed >= 39 && <=73) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Tropical Storm 39 - 73 mph - Minimal ");
}
else if (windSpeed >= 74 && <=95) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Hurricane 1 74 - 95 mph 4.0' - 5.0' Minimal to extensive");
}
else if (windSpeed >= 96 && <=110) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Hurricane 2 96 - 110 mph 6.0' - 8.0' Moderate ");
}
else if (windSpeed >= 111 && <=130) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Hurricane 3 111 - 130 mph 9.0' - 12.0' Extensive ");
}
else if (windSpeed >= 131 && <=155) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Hurricane 4 131 - 155 mph 13.0' - 16.0' Extreme ");
}
else if (windSpeed > 155) {
System.out.print(" Category Wind Speed Storm Surge Damage Potential");
System.out.println("Hurricane 5 > 155 mph > 18.0' Catastrophic ");
}
}
}