subject

I've been having a hard time getting the system to accept any code i enter.
here is my assignment:
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)
my code that keeps giving me errors no matter how i input it:
import java. util. scanner;
public class labprogram {
/* define your method here */
public static double drivingcost(
double drivenmiles, double milespergallon, double dollarspergallon); {
return drivenmiles * (1.0 / milespergallon) * dollarspergallon;
}
public static void main(string[] args); {
/* type your code here. */
public static void main(string[] args); {
scanner scnr = new scanner(system. in);
double milespergallon;
double dollarspergallon;
// set 'milespergallon' equal to 'scnr. nextdouble()'
// set 'dollarspergallon' equal to 'scnr. nextdouble()'
system. out. printf("%.2f ", drivingcost(10.0, milespergallon, dollarspergallon));
}
}
i usually do not post things online asking for , but at this point i am completely stumped.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Dave has to create animations for a game. which tool can dave use?
Answers: 3
question
Computers and Technology, 22.06.2019 22:30
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
question
Computers and Technology, 22.06.2019 22:40
When you type the pwd command, you notice that your current location on the linux filesystem is the /usr/local directory. answer the following questions, assuming that your current directory is /usr/local for each question. a. which command could you use to change to the /usr directory using an absolute pathname? b. which command could you use to change to the /usr directory using a relative pathname? c. which command could you use to change to the /usr/local/share/info directory using an absolute pathname? d. which command could you use to change to the /usr/local/share/info directory using a relative pathname? e. which command could you use to change to the /etc directory using an absolute pathname? f. which command could you use to change to the /etc directory using a relative pathname?
Answers: 3
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
You know the right answer?
I've been having a hard time getting the system to accept any code i enter.
here is my assignm...
Questions
question
History, 24.02.2021 03:30
question
Mathematics, 24.02.2021 03:30
question
Mathematics, 24.02.2021 03:30
question
Mathematics, 24.02.2021 03:30
Questions on the website: 13722360