Im new to java so I've already done this wrong probably but i need to write
"A private method pump(double pump) that "dispenses" the specified amount of gas; appropriately updates the totalSales field, and returns the cost of the gas pumped."
i was supposed to make a static field that represents the total amount of sales for the pump in dollars
an accessor method that returns the total amount of sales in dollars
a constructor that tales one double parameter, gas price per gallon
a private method that returns the cost of a given amount of gas
This is my code so far
public class GasPump
{ static int TotalPumpSales;
public static int getTotalPumpSales
{ return TotalPumpSales
}
double GasPricePerGallon;
private double getCost(double Gallons)
{ double Cost = GasPricePerGallon*Gallons
return Cost
}
I know I've messed up a lot probably, i have no idea what I'm doing right now.
if i can learn how to call the getCost method ill know how to call the one I'm asking you to help me make and i won't need help with the rest of the problem that i haven't posted.
Thanks for your time people