Professional Documents
Culture Documents
Lab 3.18 (JAVA)
Lab 3.18 (JAVA)
Output each floating-point value with two digits after the decimal point, which can
be achieved as follows:
System.out.printf("%.2f", yourValue);
Note: Real per-mile cost would also include maintenance and depreciation.
CODE(JAVA):
import java.util.Scanner;
miles_gallon = myObj.nextDouble();
gas_gallon = myObj.nextDouble();