method burnGas in class GasTank cannot be applied to given types;
required: double, double
found: no arguments
reason: actual and formal argument lists differ in length
The operator that you use here cannot be used for the
type of value that you are using it for. You are either
using the wrong type here, or the wrong operator.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:the compiler is telling you the problem. You have defined the burnGas method to take two parameters:
You have to tell it how far you are driving, and what the MPG is so it can compute how much gas is needed. But on line 81, you call burnGas with no parameters:
Java is telling you that there is no such method called burnGas that takes no parameters.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Alex Petsche wrote:Just a thought, but if I'm right could it be that it's not running correctly because there isn't a "main" method?
The quieter you are, the more you are able to hear.
Alex Petsche wrote:Ah ok. Thanks for clearing that up. Just to make sure I've got it straight a compile error is when the code logic doesn't follow through and a run error means that the code logic is correct, but the output isn't what you wanted? I guess I'm not sure what the difference is otherwise.
The quieter you are, the more you are able to hear.
Yes, the first three words you posted told us that. At least those of us who have suffered from BlueJ ourselves.Michelle Purdy wrote:We use BlueJ . . .
…and get a full list of compiler errors.javac Car.java GasTank.java
That is unfair. Maligning the compiler like that, Fred!fred rosenberger wrote:. . . But remember, the compiler is dumb. . . .
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |