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:40
"it security policy enforcement and monitoring" respond to the following: describe how monitoring worker activities can increase the security within organizations. describe the rationale that managers should use to determine the degree of monitoring that the organization should conduct. explain the extent to which you believe an organization has the right to monitor user actions and traffic. determine the actions organizations can take to mitigate the potential issues associated with monitoring user actions and traffic.
Answers: 3
question
Computers and Technology, 23.06.2019 00:40
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why.a.) student.course.callnum = "csc230"; b.) cin > > student.name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student.name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist.course.credits = 3; j.) course = studenttype.course;
Answers: 1
question
Computers and Technology, 23.06.2019 01:10
Problem 1 - hashing we would like to use initials to locate an individual. for instance, mel should locate the person mark e. lehr. note: this is all upper case. generate a hash function for the above using the numbers on your telephone. you know, each letter has a number associated with it, so examine your telephone keypad. generate 512 random 3 letter initials and take statistics on a linked list array size 512 to hold this information report how many have no elements, 1 element, 2 elements, does this agree with the hashing statistics distribution?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
To check whether your writing is clear , you can
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
question
English, 12.11.2020 02:10
question
Mathematics, 12.11.2020 02:10
question
Mathematics, 12.11.2020 02:10
question
Biology, 12.11.2020 02:10
question
Arts, 12.11.2020 02:10
question
Mathematics, 12.11.2020 02:10