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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 28 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}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply