Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class gas
- {
- public static void main(String[] args)
- {
- int gas, miles;
- double gasmileage;
- Scanner userin;
- userin = new Scanner(System.in);
- System.out.println("How many gallons of gas did you use ? :");
- gas = userin.nextInt();
- System.out.println("How many miles did you go ? :");
- miles = userin.nextInt();
- gasmileage = ( (double) miles / (double) gas );
- System.out.println("Your gas mileage was " + gasmileage + " MPG!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement