So I kept trying to run this, but for some reason, when I run my tester class, The prompt to enter gallons and mpg show up, and I enter it and my distance and cost come out as zero. Helllpp.
import java.util.Scanner;
public class MilagePrinter {
int miles = 100;
double mpg;
double gallons;
double distance;
final double COSTPERGALLON = 3.95;
public MilagePrinter() {
double thegallons;
double thempg;
Scanner input = new Scanner(System.in);
System.out.print("How many gallons are currently in the tank? ");
thegallons = input.nextDouble();
System.out.print("How fuel efficient is the car? ");
thempg = input.nextDouble();
thegallons = gallons;
thempg = mpg;
}
public double distance()
{
distance = (mpg * gallons);
return distance / miles;
}
public double cost(){
double cost = ((miles/mpg)/gallons)/COSTPERGALLON;
return cost;
}
}