Only for Java programmer or computer programming expert.

profilePerfectqsdf
CarInstrumentSimulator.java

/** *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 demonstrate the classes by creating instances of each. */ public class CarInstrumentSimulator { public static void main(String[] args) { // Create a FuelGuage object. FuelGauge fuel = new FuelGauge(); // Create an Odometer object to work with the FuelGauge object. Odometer odometer = new Odometer(999900, fuel); // Fill the car up with gas. for (int i = 0; i < fuel.MAX_GALLONS; i++) fuel.incrementGallons(); // Drive the car until it runs out of gas. while (fuel.getGallons() > 0) { // Drive a mile. odometer.incrementMileage(); // Display the mileage. System.out.println("Mileage: " + odometer.getMileage()); // Display the amount of fuel. System.out.println("Fuel level: " + fuel.getGallons() + " gallons"); System.out.println("------------------------------"); } } }