Advertisement
Guest User

gasmilage

a guest
May 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2. public class gasmilage {
  3.  
  4.     public static void main(String[] args) {
  5.         {
  6.             float milesdriven;
  7.             float gasgallons;
  8.             float result;
  9.            
  10.             Scanner keyboard = new Scanner (System.in);
  11.            
  12.         System.out.println("Miles driven?");
  13.             milesdriven = keyboard.nextFloat();
  14.            
  15.         System.out.println("Gallons of gas used?");
  16.         gasgallons = keyboard.nextFloat();
  17.        
  18.         result = milesdriven / gasgallons;
  19.  
  20.         System.out.println("Results in miles per gallon is " + result);
  21.         }  
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement