THIS IS MEANT TO BE IN JAVA So far we've learned variables, branches, loops, and some array. The assignment is: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); The output ends with a newline. This doesn't make sense to me.... Please show the end result and explain why you added what you added. This is what I have so far: import java.util.Scanner; public class LabProgram { public static void main(String[] args) { } }
THIS IS MEANT TO BE IN JAVA
So far we've learned variables, branches, loops, and some array. The assignment is:
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 20 miles, 75 miles, and 500 miles.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("%.2f", yourValue);
The output ends with a newline.
This doesn't make sense to me....
Please show the end result and explain why you added what you added. This is what I have so far:
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images