ok so I need to make this program that involves the gravity constant. but i let the user decide that
double g;
String unit;
if (n == JOptionPane.YES_OPTION) {
g = 9.8;
System.out.print(g);
unit = "meters/s";
}
else {
g = 32;
System.out.print(g);
unit = "feet/s";
}
and then i put it into this formula OUTSIDE of the if statement
double ycoord = (velo0*sinF*time)-((g)((time*time)))/2;
i know that the scope of the if statement ends after the last curly brace but i'm wondering if there is any way to call for one of the values of g
thanks in advance!