Thursday, September 9, 2010
Assignment #5 AverageCarFuel.java
/* assignment 5*/
import javax.swing.JOptionPane;
public class AverageCarFuel
{
public static void main( String args[] )
{
String milesTravled = JOptionPane.showInputDialog( "Enter number of miles traveled" );
String gallonsUsed = JOptionPane.showInputDialog( "Enter gallons used" );
double miles = Integer.parseInt( milesTravled );
double gallons = Integer.parseInt( gallonsUsed );
//gac = gas average for car
double gac = miles / gallons;
JOptionPane.showMessageDialog( null, "Your gas average is " + gac, "Your Gas Average", JOptionPane.PLAIN_MESSAGE);
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment