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 09:50
17. implement the jvm dload instruction for the mic-2. it has a 1-byte index and pushes the local variable at this position onto the stack. then it pushes the next higher word onto the stack as well
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
Janice usually works on a particular workbook that contains all business related data. she decides to keep a backup of all the data in a separate workbook. she opens a new workbook to transfer the data. which option should she use to copy all the data from one workbook to another workbook?
Answers: 1
question
Computers and Technology, 25.06.2019 09:00
What do students buy when they pay tuition? o a place to live at a school o the right to attend classes at a school o transportation expenses to attend classes o textbooks
Answers: 2
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
Questions on the website: 13722367