fork download
  1. class MileConversions
  2. {
  3. public static void main(String[] args)
  4. {
  5. //Named Constants
  6. final int INCHES_TO_MILES = 63360;
  7. final int FEET_TO_MILES = 5280;
  8. final int YARDS_IN_MILES = 1760;
  9.  
  10. //Number of miles
  11. int miles = 1;
  12.  
  13. //Conversions
  14. int totalYards = miles * YARDS_IN_MILES;
  15. int totalFeet = miles * FEET_TO_MILES;
  16. int totalInches = miles * INCHES_TO_MILES;
  17.  
  18. //Explanatory Text
  19. System.out.println("There is " + miles + " mile, which is equalivent to:");
  20. System.out.println(totalYards + " yards");
  21. System.out.println(totalFeet + " feet");
  22. System.out.println(totalInches + " inches");
  23. }
  24. }
Success #stdin #stdout 0.15s 55480KB
stdin
Standard input is empty
stdout
There is 1 mile, which is equalivent to:
1760 yards
5280 feet
63360 inches