Calculating the speed of a bicycle given the gear size and cadence
Your question here is again an improvement over your previous version, but, I was hoping you would take some of the abstraction suggestions and apply them.

As it stands, your program is not a general purpose program, rather it is a complex constant value...

Let's look at the things that are actual constants:


PI - 3.14 (though, for more accuracy, use Math.PI constant).
12 inches in a foot
5280 feet in a mile
60 minutes per hour


Those are your constants, and should be declared as private static final.

The things which are variables, are the cadence, and the 'gear size'.

A general purpose program would have a method that takes those two variables, and returns a speed....:

public static double calculateSpeed(double gearSize, double cadence) {...}


That method would be reusable, and general, and it exposes the right amount of functionality without exposing the inner workings of the class.

In your main method, if you would call:

System.out.println(calculateSpeed(100, 90) + "mph");


or rather, you would get the 100 and the 90 from somewhere else, perhaps a constant for the purpose of this exercise.

Now, how do you implement the calculateSpeed function? That is where the smarts of your program should be, and it should perhaps call other private methods, or do some basic calculations.

There are some style issues I see, but the most significant is that I always recommend using decimal-style typed values when you are using a double literal in your code. You have code like:


private static double feetPerInches() {
    return 1.0 / 12;
}



That produces the right results, but I recommend expressing the 12 as 12.0 to make the implicit conversions absolutely clear. I have seen too many times when bugs were introduced by integer arithmetic when floating-point was expected.

Bottom line, I would expect your program to look like:

private static final double PI = 3.14;
private static final double MINS_PER_HOUR = 60.0;
private static final double FEET_PER_MILE = 5280.0;
private static final double INCHES_PER_FOOT = 12.0;
private static final double INCHES_PER_MILE = FEET_PER_MILE * INCHES_PER_FOOT;

public static final double getSpeed(double gearSize, double cadence) {
    ....
}

public static void main(String[] args) {
    System.out.printf("%.3fmph%n", getSpeed(100.0, 90.0));
}


Note, I have used a printf at the end to simplify the logic of the output. Well, it is simpler for me, but, I thought you should see how printfs are used in Java. What that printf says, is print a floating-point value with 3 decimal places (%.3f), followed by 'mph', followed by a newline %n. The floating value to print is the speed.