public class Gas {
public static void main(String[] args) {
double price = Double.parseDouble(args[0]);
double amount = Double.parseDouble(args[1]);
Boolean pay;
double finalCost;
double cost = (price*amount);
if(pay = false){
finalCost = cost;
cost = cost*0.1;
finalCost = cost + finalCost;
System.out.println(finalCost);
}
if(pay = true){
System.out.println(cost);
}
}
}
Basically my code determines cost of gas, so if pay = false then a credit card is being used and their is an extra charge of 10%. Whereas if pay = true, then cash is being used. Whenever I put in false, it prints out the value as if it was true. How could I fix this?