0 replies
Hi guys,

I have this

/*
* This is a Calculator of a Trip
*/
package javaapplication1;
import java.util.Scanner;

/**
*
* Omar Guaba
*/
public class JavaApplication1 {

/**
* This are the specifications of the first method of this app
*/
public static void main(String[] args) {
// double distance;
// double mpg;
// double pricePerGallon;
// double totalCost;
//
double distance, mpg, pricePerGallon, totalCost;

Scanner cos = new Scanner(System.in);
System.out.println("Total Distance in miles):");
distance = cos.nextDouble();
System.out.println("Miles Per Gallon");
mpg = cos.nextDouble();
System.out.println("Price Per Gallon:");
pricePerGallon = cos.nextDouble();

totalCost = (distance/mpg)*pricePerGallon;
System.out.printf("Total Cost of the Trip",totalCost);
System.out.println();



}

}

Java does not perform the calculation at all. Why?
#calculation

Trending Topics