Created
October 9, 2013 17:20
-
-
Save imryan/6904887 to your computer and use it in GitHub Desktop.
Stupid mileage program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Mileage { | |
public static void main(String[] args) { | |
// Declare variables | |
Scanner sc = new Scanner(System.in); | |
double miles; | |
double gallons; | |
double mileage; | |
// Get input | |
miles = sc.nextDouble(); | |
gallons = sc.nextDouble(); | |
// Calculate mileage | |
mileage = (miles / gallons); | |
// Output result | |
System.out.println("\nYour mileage is: " + mileage + " for " + miles + " miles."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment