Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.*;
  2. public class gas
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.     int gas, miles;
  7.     double gasmileage;
  8.     Scanner userin;
  9.     userin = new Scanner(System.in);
  10.    
  11.     System.out.println("How many gallons of gas did you use ? :");
  12.     gas = userin.nextInt();
  13.     System.out.println("How many miles did you go ? :");
  14.     miles = userin.nextInt();
  15.  
  16.     gasmileage = ( (double) miles / (double) gas );
  17.     System.out.println("Your gas mileage was " + gasmileage + " MPG!");
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement