Saturday, August 3, 2013

Exercise no. 4

import java.util.*;
public class MileAge {

    public static void main(String[] args) {
        Scanner x= new Scanner(System.in);
      
        double milesdriven,gallonsused,milespergallon;
      
        System.out.println("Enter Miles Driven: ");
        milesdriven=x.nextDouble();
       
        System.out.println("Enter Gallons Used: ");
        gallonsused=x.nextDouble();
       
        milespergallon=milesdriven/gallonsused;
        System.out.println("The Miles Per Gallon Is: "+milespergallon);
              
      
    }

}

No comments:

Post a Comment