Answer:
The answer to this question can be given as:
Class definition:
public class GasTank //define class GasTank
{
private double amount = 0; //define variable.
public void addGas(double x) //define function addGas.
{
amount=amount+x; //calculate value.
}
public void useGas(double x) //define function useGas.
{
amount=amount-x; //calculate value.
}
public double getGasLevel() //define function getGasLevel
{
return amount; //return value.
}
}
Explanation:
The description of the above class definition can be given as: