Answer:
The solution in Java programming language is given in the explanation section
Pay close attention to the explanation of the steps given as comments
Step-by-step explanation:
//Create class GasTank
class GasTank{
//Set Instance Variable amount to 0
private double amount = 0;
//Create the method addGas
public void addGas(double amtGas){
this.amount+=amtGas;
}
//Create method useGas
public void useGas(double amtGas){
this.amount-=amtGas;
}
//Create the method isEmpty
public boolean isEmpty(){
if(this.amount<0.1){
return true;
}
else{
return false;
}
}
//Create method getGasLevel
public double getGasLevel(){
return this.amount;
}
}