Only for java Programmer or Computer Science Expert Not Essay Writer Please

SaMsRa@1
FuelGauge.java

/** * Description: The class FuelGauge is used simulate car fuelGauge. It contains * variable gallons which indicate the amount of fuel in tank measured * in gallons. the MAX_GALLONS value hold the maximum gallons allowed * Class: Fall - COSC 1437.81003 * Assignment7: FuelGauge class code * Date: 10/23/2018 * @author Bhaskar Bharati * @version 0.6.12 */ /** * This class calculates the number of days based on the month * and year. */ public class FuelGauge { private double gallons; final int MAX_GALLONS = 15; /** * Constructor for FuelGauge initializes the gallons to specified value g * * @param g is a number of gallons */ public FuelGauge(double g) { if (gallons >= 0 && g <= MAX_GALLONS) { this.gallons = g; } else { gallons = 0; System.out.println(); } } /** * getGallon method is used to access the value of Gallons * * @return gallons value */ public double getGallons() { return gallons; } /** * IncrementGallons method is used to increment the value of gallons by one * for every call */ public void incrementGallons() { if (gallons <= MAX_GALLONS) { gallons += 1; } } /** * decrementGallons method is used to reduce the number of gallons by 1 for * each call. if the value of gallons is greater or equal to 1 reduction * will take place else */ public void decrementGallons() { if (gallons >= 1) { gallons -= 1; } else System.out.println("The car has run out of fuel"); } }