Java programmer only.
/** *Description: This program will demonstrate the classes by creating instances of each. Stimulate filling the car up with fuel, then run aloop that increament the odometer until the car runs out of fuel. *Class: Fall - COSC 1437.81002 *Assignment7: CarInstrumentSimulator class code *Date: 10/23/2018 *@author Deepak Bhusal *@version 0.0.0 */ /** * This class used to calculate the value of FuelGauge */ public class FuelGauge { private int gallons; public final int MAX_GALLONS = 15; public FuelGauge() { gallons = 0; } /** * Constructor should initialize the number of gallons of gas. If the * gallons is greater than the max it will default to the max. * @param gallons */ public FuelGauge(int g) { gallons = g; } public int getGallons() { return gallons; } /** * incrementGallons Method will add one gallon, if gallon is greater than the max for the * tank then a message will be output. */ public void incrementGallons() { if (gallons < MAX_GALLONS) gallons+= 1; } /** * decrementGallons Method will subtract one gallon, if gallon is greater than the max for the * tank then a message will be output. */ public void decrementGallons() { if (gallons >= 1) gallons -= 1; } }