Marx+java+code

/** MilesToKilometerConverter.java converts miles to Kilometers


 * @author Anthony Marx


 * @version for Alice+Java book

import java.util.Scanner; // imports the command utilities for java public class MilesToKilometerCoverter { // name of the class

public static void main (String[] args) {

System.out.print("how many miles do you want to convert? "); // has the program display the words "..."

Scanner kbd = new Scanner(System.in); // allows the user to type numbers into the program for it to do something with

double miles = kbd.nextDouble; // stores the value for miles

double kilometers = miles * 1.609344; // computes the conversion for miles times the unit conversion of kilometers per mile

System.out.printf("%.1f miles => %.1f kilometers", miles, kilometers); // tells the program to put labels after the variables for miles and kilometers, also rounds to one decimal point

}

}