Почему я получаю сообщение об ошибке для одной из моих переменных, хотя она должна компилироваться? [закрыто] ⇐ JAVA
-
Anonymous
Почему я получаю сообщение об ошибке для одной из моих переменных, хотя она должна компилироваться? [закрыто]
I am writing a trajectory modeling project in Java for my class, I think the code should be working as intended, but I keep getting an error message for line 29 of my program, and it should be recognized as a variable.
My program code is as follows:
import java.util.Scanner; public class TrajectoryModeling { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); /* Get the distance to the target from user input*/ System.out.print("Enter a distance to target: "); double targetDistance = scanner.nextDouble(); double bestAngle = 0.0; double bestSpeed = 0.0; double minMiss = Double.MAX_VALUE; /* Constants */ final double GRAVITY = 9.8; final double MIN_SPEED = 1.0; final double MAX_SPEEED = 30.0; final double ANGLE_INCREMENT = 5.0; /* loop through all of the speeds and angles entered to find the best combination of the two */ for (double speed = MIN_SPEED; speed
Источник: https://stackoverflow.com/questions/781 ... ould-be-co
I am writing a trajectory modeling project in Java for my class, I think the code should be working as intended, but I keep getting an error message for line 29 of my program, and it should be recognized as a variable.
My program code is as follows:
import java.util.Scanner; public class TrajectoryModeling { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); /* Get the distance to the target from user input*/ System.out.print("Enter a distance to target: "); double targetDistance = scanner.nextDouble(); double bestAngle = 0.0; double bestSpeed = 0.0; double minMiss = Double.MAX_VALUE; /* Constants */ final double GRAVITY = 9.8; final double MIN_SPEED = 1.0; final double MAX_SPEEED = 30.0; final double ANGLE_INCREMENT = 5.0; /* loop through all of the speeds and angles entered to find the best combination of the two */ for (double speed = MIN_SPEED; speed
Источник: https://stackoverflow.com/questions/781 ... ould-be-co
Мобильная версия