Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gas_mileage;
- import java.util.Scanner;
- public class Gas_mileage {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.println("Gallons of Gas: ");
- double gas = scanner.nextDouble();
- System.out.println("Miles Driven: ");
- double miles = scanner.nextDouble();
- double mpg = miles / gas;
- System.out.println("MPG: " + mpg);
- scanner.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement