11 12 13 14 15 16 17 18 PARTNER 25 19 20 21 22 23 24...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
11 12 13 14 15 16 17 18 PARTNER 25 19 20 21 22 23 24 } } Scanner scanner = new Scanner(System.in); double milesPerGallon, dollarsPerGallon; milesPerGallon = scanner.nextDouble(); dollarsPerGallon = scanner.nextDouble(); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 10)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 50)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 400)); Develop mode Submit mode Submit for grading Coding trail of your work 9/11 U-0,0,0,0,0,0,0,0,6, 0,6--0,6 min: 12 What is this? Latest submission - 10:58 AM EDT on 09/11/22 Only show failing tests 1: Compare output When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input 20.0 3.1599 Your output Expected output 1.58 7.90 63.20 1.58 7.90 63.204 Total score: 6/10 Download this submission 0/2 Write a method drivingCost() with input parameters milesPerGallon, dollarsPerGallon, and milesDriven that returns the dollar cost to drive those miles. All items are of type double. The method called with arguments (20.0, 3.1599, 50.0) returns 7.89975. Define that method in a program whose inputs are the car's miles per gallon and the price of gas in dollars per gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your driving Cost() 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 milesPerGallon, double dollarsPerGallon, double milesDriven) 428330.2306172.qx3zqy7 1 import java.util.Scanner; 2 3 public class LabProgram { 5 6 7 8 9 10 #2997992 11 12 13 14 15 16 17 18 19 20 21 22 23 24 } 25 LabProgram.java public static double drivingCost (double milesPerGallon, double dollars PerGallon, double milesDriven) { double gallons = milesDriven / milesPerGallon; return gallons * dollarsPerGallon; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double milesPerGallon, dollars PerGallon; milesPerGallon = scanner.nextDouble(); dollarsPerGallon = scanner.nextDouble(); } System.out.printf("%.2f ", driving Cost (milesPerGallon, dollarsPerGallon, 10)); Load default template... System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 50)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 400)); 11 12 13 14 15 16 17 18 PARTNER 25 19 20 21 22 23 24 } } Scanner scanner = new Scanner(System.in); double milesPerGallon, dollarsPerGallon; milesPerGallon = scanner.nextDouble(); dollarsPerGallon = scanner.nextDouble(); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 10)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 50)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 400)); Develop mode Submit mode Submit for grading Coding trail of your work 9/11 U-0,0,0,0,0,0,0,0,6, 0,6--0,6 min: 12 What is this? Latest submission - 10:58 AM EDT on 09/11/22 Only show failing tests 1: Compare output When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input 20.0 3.1599 Your output Expected output 1.58 7.90 63.20 1.58 7.90 63.204 Total score: 6/10 Download this submission 0/2 11 12 13 14 15 16 17 18 PARTNER 25 19 20 21 22 23 24 } } Scanner scanner = new Scanner(System.in); double milesPerGallon, dollarsPerGallon; milesPerGallon = scanner.nextDouble(); dollarsPerGallon = scanner.nextDouble(); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 10)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 50)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 400)); Develop mode Submit mode Submit for grading Coding trail of your work 9/11 U-0,0,0,0,0,0,0,0,6, 0,6--0,6 min: 12 What is this? Latest submission - 10:58 AM EDT on 09/11/22 Only show failing tests 1: Compare output When done developing your program, press the Submit for grading button below. This will submit your program for auto-grading. Output is nearly correct, but whitespace differs. See highlights below. Special character legend Input 20.0 3.1599 Your output Expected output 1.58 7.90 63.20 1.58 7.90 63.204 Total score: 6/10 Download this submission 0/2 Write a method drivingCost() with input parameters milesPerGallon, dollarsPerGallon, and milesDriven that returns the dollar cost to drive those miles. All items are of type double. The method called with arguments (20.0, 3.1599, 50.0) returns 7.89975. Define that method in a program whose inputs are the car's miles per gallon and the price of gas in dollars per gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your driving Cost() 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 milesPerGallon, double dollarsPerGallon, double milesDriven) 428330.2306172.qx3zqy7 Write a method drivingCost() with input parameters milesPerGallon, dollarsPerGallon, and milesDriven that returns the dollar cost to drive those miles. All items are of type double. The method called with arguments (20.0, 3.1599, 50.0) returns 7.89975. Define that method in a program whose inputs are the car's miles per gallon and the price of gas in dollars per gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your driving Cost() 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 milesPerGallon, double dollarsPerGallon, double milesDriven) 428330.2306172.qx3zqy7 1 import java.util.Scanner; 2 3 public class LabProgram { 5 6 7 8 9 10 #2997992 11 12 13 14 15 16 17 18 19 20 21 22 23 24 } 25 LabProgram.java public static double drivingCost (double milesPerGallon, double dollars PerGallon, double milesDriven) { double gallons = milesDriven / milesPerGallon; return gallons * dollarsPerGallon; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double milesPerGallon, dollars PerGallon; milesPerGallon = scanner.nextDouble(); dollarsPerGallon = scanner.nextDouble(); } System.out.printf("%.2f ", driving Cost (milesPerGallon, dollarsPerGallon, 10)); Load default template... System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 50)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 400)); 1 import java.util.Scanner; 2 3 public class LabProgram { 5 6 7 8 9 10 #2997992 11 12 13 14 15 16 17 18 19 20 21 22 23 24 } 25 LabProgram.java public static double drivingCost (double milesPerGallon, double dollars PerGallon, double milesDriven) { double gallons = milesDriven / milesPerGallon; return gallons * dollarsPerGallon; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double milesPerGallon, dollars PerGallon; milesPerGallon = scanner.nextDouble(); dollarsPerGallon = scanner.nextDouble(); } System.out.printf("%.2f ", driving Cost (milesPerGallon, dollarsPerGallon, 10)); Load default template... System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 50)); System.out.printf("%.2f ", drivingCost (milesPerGallon, dollarsPerGallon, 400));
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Explain the Planning process group elements: Risk and Procurement Management -Communication and Stakeholde! Management
-
Arbitration, mediation, reference to a third person , an association tribunal, summary jury trial, rent-a-judge, minitrials and judicial triage, are all forms of what is known as?
-
Prove lim(5x-17) = -2 x3
-
Juanita Torres is 35-years old and lately has been working with her financial planner. She is attempting develop a long-term savings and investment program. She has been thinking about all the major...
-
Find all values of k for which the following homogeneous systems of linear equations have a nontrivial solution: (a) x + k y = 0 kx + 4y = 0 (b) x1 + kx2 + 4x3 = 0 kx1 + X2 + 2x3 = 0 2x1 + kx2 +8x3 =...
-
Safari File Edit View History Bookmarks Window Help coursehero.com Robinhoodie ( Sat Feb 4 11:08 PM Advising Appoint... T 2022DEC STA-2... Course Hero Course Hero Course Hero https://www.mas......
-
The 2014 financial statements of LVMH Moet Hennessey-Louis Vuitton S.A. are presented in Appendix C of this book. LVMH is a Paris-based holding company and one of the worlds largest and best-known...
-
Bill Alexander and his wife Valerie are both employed. Bill will have an adjusted gross income this year of $70,000. Valerie has an adjusted gross income of $2000 a month. Bill and Valerie have...
-
Kitty is a lawful gun dealer. Two weeks ago, at a family dinner, Kitty's cousin Julie was complaining about her neighbor. Julie explained that the neighbor was hosting loud parties until 3:00 a.m....
-
In 20X2, the new CEO of Watsontown Electric Supply became concerned about the companys apparently deteriorating financial position. Wishing to make certain that the grim monthly reports he was...
-
A company's directors have decided to provide senior managers with a performance bonus scheme. The bonus scheme entitles the managers to a cash payment of 10,000 should the company share price have...
-
Payroll Manager: Leads the payroll department, strategizes payroll operations, and collaborates with HR and finance departments to ensure effective payroll management. What jobs are available within...
-
Alsobrooks Corporation uses a job-order costing system with a single plantwide predetermined overhead rate based on machine-hours. The company based its predetermined overhead rate for the current...
-
A composite laminate has been constructed from six identical layers of a plain (0/90 woven) aramid fabric with epoxy resin. Each layer, or lamina, has a fibre volume fraction (V) of 0.7, and a resin...
-
The following are comparative balance sheets for Sheffield Company. SHEFFIELD Company Comparative Balance Sheets December 31 Assets 2022 2021 Cash $72,800 $32,900 Accounts receivable 86,400 70,700...
-
Is there a value of c so that the given system has no solution? Explain. -3x + cy 6.x 1 - 2y = -2
-
c. Develop class Polynomial as follows: i. It has one field representing the coefficients of the polynomial using an array of double. A polynomial is assumed to have the form ao + ax +...+ an-1xn-1....
-
How many years will it take a $700 balance to grow into $900 in an account earning 5%?
-
Megan is working with a distribution of reaction times that is positively skewed. Megan transforms the reaction times to z scores. 1. Will the distribution of these z scores have an approximately...
-
Using the results of Exercise 3 and Exercise 8, write a statement reporting the outcome as it might appear in a published article. Data from exercise 8 Calculate a standardized effect size, Cohens d,...
-
In a 2016 survey, Americans were asked to name their favorite actor. The most often mentioned living actors are shown below along with their ages in 2016. (John Wayne was number 4 in the list, but we...
-
The following selected data were obtained from the financial statements of Blake Enterprises: Calculate the following financial measures for Blake Enterprises: 1. Free cash flow 2....
-
Husky Companys 2019 income statement and comparative balance sheets as of December 31 of 2019 and 2018 are shown below: Cash dividends of \($58,000\) were declared and paid during 2019. Plant assets...
-
Terry Companys income statement and comparative balance sheets at December 31, 2019 and 2018, are as follows: Cash dividends of \($17,000\) were declared and paid during 2019. Plant assets were...
Study smarter with the SolutionInn App