Hello there,
I am currently enrolled in a computer science class at my school, and I need some help with a program.

My teacher started up a rocket club at our school with great success, but he needs some help with minor problems. He uses parachutes to bring his rockets safely back to the ground, but he wanted to know how much PSI a gram of gun powder produces. He wants me to create a program in java to determine the amount. I got everything working, but I can't seem to get an output if the amount of gunpowder is less than one gram.

I currently have the grams of powder set as a float variable and my equation for finding the PSI is set as :

psi = (grams * 100) / (0.04f * (rdia * rdia) * rlen);
(rdia is the radius of the rocket and rlen is the length of the rocket, both in inches.)

Also my output command is set as
outputLabel.setText("Your PSI is " + PSI);

I know that the equation is right as I have tried other programs out there to see if it works, but I can't get anything under 1 gram to print a result.

Rohan_Shenoy

02-13-2008, 09:33 PM

He wants me to create a program in java to determine the amoun
Java is not same as Javascript!

sobrien79

02-13-2008, 10:50 PM

Java is not same as Javascript!

I think he is working with Java and not JavaScript.

cowbell1, can you provide more of the code where you read in the vars and where you declare psi? The first thing that comes to mind is that psi is declared as as int or long.