miles - System.out.println Scanner reader = new...

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

View Full Document Right Arrow Icon
package javaapplication1; import javax.swing.*; // For JFrame import java.awt.*; // For Color and Container import java.util.Scanner; import java.text.DecimalFormat; /* @author */ public class Main { public static void main(String[] args) { double miles, kilometers; System.out.println(); System.out.println("Hello World by Mr. Nate Campbell for CS161");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println(); Scanner reader = new Scanner(; System.out.println ("Enter distance in miles: "); miles = reader.nextInt(); kilometers = miles * 1.609 ; DecimalFormat df1 = new DecimalFormat("###.000"); System.out.print("Distance in kilometers is: "); System.out.print(df1.format(kilometers)); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online