MilesToKilometers -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // MilesToKilometers.java Author: Lewis and Loftus // // Solution to Programming Project 2.5 //******************************************************************** / import java.util.Scanner; i public class MilesToKilometers { //----------------------------------------------------------------- // Converts miles into kilometers. The value for miles is read // from the user.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //-----------------------------------------------------------------public static void main (String args) { final double MILES_PER_KILOMETER = 1.60935; double miles, kilometers; System.out.print ("Enter the distance in miles: "); Scanner sc = new Scanner(System.in); miles = sc.nextDouble(); kilometers = MILES_PER_KILOMETER * miles; System.out.println ("That distance in kilometers is: " + kilometers); } }...
View Full Document

Ask a homework question - tutors are online