2.16 LAB: Driving cost - methods Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are...


I need help writing this code


also in the picture it ask for the "Enter program input" can you please tell me what input you would put in that section below.


Pictures would be greatly apperciated


2.16 LAB: Driving cost - methods<br>Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the<br>dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns<br>7.89975.<br>Define that method in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output<br>the gas cost for 10 miles, 50 miles, and 400 miles, by calling your drivingCost() method three times.<br>Output each floating-point value with two digits after the decimal point, which can be achieved as follows:<br>System.out.printf(

Extracted text: 2.16 LAB: Driving cost - methods Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the method is called with 50 20.0 3.1599, the method returns 7.89975. Define that method in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your drivingCost() method three times. 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. Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Your program must define and call a method: public static double drivingCost (double drivenMiles, double milesPerGallon, double dollarsPerGallon) Note: This is a lab from a previous chapter that now requires the use of a method. 283902.2300530.qx3zqy7 LAB 2.16.1: LAB: Driving cost - methods 0/ 10 ACTIVITY LabProgram.java Load default template... 1 import java.util.Scanner; 2 3 public class LabProgram { 4 /* Define your method here */ public static void main(String[] args) { /* Type your code here. */ } 7 8 9. 10 } 11 Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. Develop mode Submit mode Enter program input (optional) If your code requires input values, provide them here. LabProgram.java (Your program) Run program Input (from above) Output (shown below) Program output displayed here
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here