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
-
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...
-
Refer to the financial statements of American Eagle Outfitters given in Appendix B at the end of this book. At the bottom of each statement, the company warns readers to "Refer to Notes to...
-
1. Give an anecdote of a time you encountered a misunderstanding through the use of online information technologies, or resolution of a face-to- face conflict through online information technologies....
-
Vince Smith opened a law office on March 2, 2010. During the first month of operations, the business completed the following transactions: Requirements 1. Open the following T-accounts: Cash,...
-
Is there a significant difference in Internet use per week between different educational groups? Using data from the GSS10SSDS, we ran an ANOVA model using DEGREE (educational attainment) as the...
-
(10 points) If 8 f(x)dx = -2, then 8 1 f(t)dt =
-
Textflix is a new idea to help reduce college student cost of textbooks. Textflix is a new project to be undertaken by the Netflix Corporation. Textflix will charge $20 per month to have access to a...
-
1. what is the function of Direct Memory Access in a computer? 2. Describe the term PAL briefly with a structural diagram? 3. as an embeded system designer you are to build some complex Embeded...
-
Where are variable costs and revenues budgeted to be different at each activity level?
-
Carry out a mini-research and share with the class any interesting article that you have seen or read about that is related to careers or latest trends and technology in the Database Industry. Be...
-
There are no results for At December 31, 2021, the general ledger and subsidiary ledger for Wow's, a small beauty supply company, showed the following: General Ledger Accounts Receivable Subsidiary...
-
To prepare for this question, first create new table in the ischool_v2 database called new_person_records . The code for creating the table is provided in Q1_Partial_Code.sql. For this question,...
-
1. The following probability distributions of returns for two stocks have been estimated: Probability 0.25 Stock X Stock Y 3% 6% 0.35 8% 3% 0.40 6% 1% What is the coefficient of variation for the...
-
please helllpppp. 10. Budgies (Melanopsittacus undulatus) are attractive birds that come in many colors. Budgies may produce either or both of two types of pigment in their feathers: a blue pigment...
-
What is the amount of total interest dollars earned on a $5,000 deposit earning 6% for 20 years?
-
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...
-
Assume Knowlton Holdings Ltd. completed these long-term non-strategic investment transactions during 2020 : 1. Journalize Knowlton's investment transactions assuming the company reports any changes...
-
Suppose on February 1, 2020, General Motors paid \(\$ 41\) million for a \(40 \%\) investment in ABC Ltd., an auto parts manufacturer. Assume \(A B C\) earned net income of \(\$ 6\) million and paid...
-
Return to exercise SB-7, the Prudential Bache (PB) investment in CitiCorp bonds. Journalize the following on PB's books: a. Purchase of the bond investment on January 2, 2020. PB expects to hold the...
Study smarter with the SolutionInn App