| Author |
Error
|
Holly Leery
Ranch Hand
Joined: Sep 08, 2004
Posts: 97
|
|
Ok I have a question about the following code. I keep getting errors about the "static double findCharge(int Kwh)" line. Does something need to be before that to make it compile like public static int( ) ??? Help anyone?
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
Hi Holly, You've "nested" the definition of findCharge() inside your main() method, and that's not allowed. Method definitions all have to be at the "top level" of a class, enclosed only by the class X {...} set of braces.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Holly Leery
Ranch Hand
Joined: Sep 08, 2004
Posts: 97
|
|
So do I just move the static double part of the code or the whole while loop? Sorry I am sure that is a dumb question
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
|
|
|
You need to move the method "static double part of the code" out of the while loop. In the while loop it looks like you'll need to call that method.
|
 |
Holly Leery
Ranch Hand
Joined: Sep 08, 2004
Posts: 97
|
|
|
Ok I understand..but I am still a little sketchy as to how to write that...any more help? I know it is probably hard to help with this problem. I don't quiet understand yet. Thanks again I really appreciate it.
|
 |
 |
|
|
subject: Error
|
|
|