I'm trying to compute the gravitational force of two objects.
I can get it to compile but can't get the program to display the result of the Constant or the expression (gForce =G * m1 * m2 / R^2). I've been looking at this for a few hours now so any info will help.
It could be that 0.000000000066742 is too small for a double (I don't think it is but you never know). Try putting in 1.0 as a test and see if it works.
You're telling the computer to print a fixed point number, but only 2 digits of precision. So really small numbers like 0.000045 don't get printed properly because it's only printing the first 2 digits of precision (ie: 0.00)
I tried the fixes and can display the constant now but "gforce" is not working is my expression invalid? gForce = (GRAVITY * (mass1 * mass2) / (dist*dist))
You calculate gForce before you allow the user to enter anything. On line 26 values of mass1 mass2 and dist are not defined. Move this line to line 38.
You're not doing this in the first piece of code. Why did you change it?