Advertisement
Guest User

Roggow_GasMileageProgram

a guest
May 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. package gas_mileage;
  2. import java.util.Scanner;
  3.  
  4. public class GasMileageCalculator {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.  
  9.         System.out.println("Distance Traveled");
  10.         int d = scan.nextInt();
  11.        
  12.         System.out.println("Gallons of Gas Used");
  13.         double f = scan.nextDouble();
  14.    
  15.         double m = (d/f);
  16.         int i = (int)m;
  17.        
  18.        
  19.         System.out.println("Fuel Mileage=" +i + "MPG");
  20.        
  21.         scan.close();      
  22.  
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement