Page 1 of 1

1.21 LAB: Driving costs Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both dou

Posted: Tue Jul 12, 2022 8:17 am
by answerhappygod
1 21 Lab Driving Costs Driving Is Expensive Write A Program With A Car S Miles Gallon And Gas Dollars Gallon Both Dou 1
1 21 Lab Driving Costs Driving Is Expensive Write A Program With A Car S Miles Gallon And Gas Dollars Gallon Both Dou 1 (20.33 KiB) Viewed 29 times
1.21 LAB: Driving costs 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", youryalue); The output ends with a newline. Ex: If the input is: 20.03.1599 the output is: 3.1611.8579.00 Note: Real per-mile cost would also include maintenance and depreciation. 417690.2325030.9×329y7 \begin{tabular}{|l|l} LAB \\ AGTVITY & 1.21.1: LAB: Driving costs \end{tabular} LabProgram.java Load default template... \begin{tabular}{l|l} 1 & import java.util.Scanner ; \\ 2 & \\ 3 & public class Labprogram \{ \\ 4 & public static void main(String[] args) \{ \\ 5 & /∗ Jype your code here. ∗/ \\ 6 & \} \end{tabular}