this is my first program using more than one method. while i like it because of its modularity and cleanness, i despise it for its multiple new problems it introduces into my world where i was just getting the hang of the old style. i am supposed to be doing a program that calculates a persons gravity on all 9 planets. if i am really far out on some of the things that i am trying to do, please let me know. my familiarity level with all of this is pretty low.
public class WeightOnPlanetsV1
{
public static double [] gravity()throws IOException
{
int counter = 0;
double [] gravity = new double[9];
File fileName = new File("surfaceGravity.txt");
Scanner inFile = new Scanner(fileName);
while (inFile.hasNext())
{
gravity[counter] = inFile.nextDouble();
counter++;
}
inFile.close();
return gravity;
}
public static int [] pounds(double[]gravity, double []weightPounds)
{
for (int counter = 0; counter <= 9; counter++)
{
weightPounds[counter] = (140) * gravity[counter];
}
return weightPounds;
}
public static double [] grams(double [] weightGrams, int [] weightPounds)
{
for (int counter = 0; gravity.length; counter++)
{
weightGrams[counter] = weightPounds[weightPounds] * 453.59237;
}
return weightGrams;
}
public static double mass(double [] mass, double [] weightGrams, double [] gravity)
{
for (int counter = 0; gravity.length; counter++)
{
return mass[counter] = (weightGrams[counter] * (433.59237) / gravity[counter]);
}
}
public static void main(String[] args)
{
}
}