Average speed in miles

The problem

Assume a runner runs 14 kilometers in 45 minutes and 30 seconds. For this task, write a program that displays the average speed in miles per hour. (Note that 1 mile is 1.6 kilometers.)

Breaking it down

First creating KILOMETERS which represents the miles that was run and MILES that converts miles to kilometers the conversion. Next we need to create a forumula that will multiple do the math. Finally we will print the output.

private static double KILOMETERS = 14.0;
private static double MILES = KILOMETERS / 1.6;

public static void main(String[] strings) {

    double formula = (45.5 * 60.0 + 30.0) / (60.0 * 60.0);
    double milesPerHour = MILES / formula;

    System.out.println(milesPerHour);
}

Output

11.41304347826087