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 13:30
Asoftware company hired ray, a college graduate to work in their development team. ray is assigned to work in the coding phase of a project. what happens during the coding phase of a software development project? a. the customer receives a working model of the software. b. developers convert the program design into code. c. developers gather requirements directly from the stakeholders. d. testing teams check the product for quality.
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Cloud computing service providers manage different computing resources based on the services they offer. which resources do iaas and paas providers not manage? iaas providers do not manage the for the client, whereas paas providers usually do not manage the for their clients. iaas- storage server operating system network paas- applications interafce storage vertualiation
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
Answers: 1
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
Mathematics, 22.08.2019 17:30
question
Computers and Technology, 22.08.2019 17:30
question
Mathematics, 22.08.2019 17:30
Questions on the website: 13722362