• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need some debugging assistance  RSS feed

 
Dan Good
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again,

Curious if someone can help me debug this program.

Syntax error on line 7:

 
Louis Denning
Ranch Hand
Posts: 64
4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot the type identifier, double.
It should be static double PAY_RATE = 18.35;
 
Dan Good
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I made that correction, it said I had a duplicate on lines 6 and 7. But if I delete one, then I get more bugs.
 
Louis Denning
Ranch Hand
Posts: 64
4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's because you declared two variables with the same name, as they are both named PAY_RATE
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solve the first problem, then worry about any that remain (if any).

By the way, the tern "debugging" is usually used to describe solving run-time issues, rather than compiler problems.
 
Dan Good
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This program with no bugs now, still won't compile any ideas?

 
Louis Denning
Ranch Hand
Posts: 64
4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see something weird with lines 24 to 27. What's the compile error?
 
Dan Good
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Error: Could not find or load main class hellowworld.exercise22

How is that possible?
 
Louis Denning
Ranch Hand
Posts: 64
4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what IDE you are using, but maybe you should change the main class to exercise23, since you want this one to run.
Also, by convention, class names have the first lettre of the words in their names capitalised like FruitCake instead of fruitcake.
Just a little tidbit
 
Nam Ha Minh
Ranch Hand
Posts: 515
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan Good wrote:Error: Could not find or load main class hellowworld.exercise22

How is that possible?


The signature of the main() method is wrong. Correct it.
 
Dan Good
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It didn't fix the compiling error, drat. Maybe I need to import something?
 
Louis Denning
Ranch Hand
Posts: 64
4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:
Dan Good wrote:Error: Could not find or load main class hellowworld.exercise22

How is that possible?


The signature of the main() method is wrong. Correct it.

Yes, that too. But this one seems to be exercise23, though. Try correcting the main() member function
of exercise22 to avoid future problems and then set exercise23 to be your new main class.
 
Dan Good
Ranch Hand
Posts: 49
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All set thanks! Had a class mix up after I tried changing something else. Cheers
 
Louis Denning
Ranch Hand
Posts: 64
4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still, I notice something weird with the lines
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dan Good wrote:It didn't fix the compiling error, drat. Maybe I need to import something?

No offense, but it sounds like you are simply guessing what the problem is, and guessing what the fix is.

compiler errors are VERY specific about what the problem is. They will often tell you the line and even the exact spot. You should learn to read them and understand what they mean. By all means ask questions about them here, but when you do, please post them VERBATIM, along with the current code you are compiling.

Programming isn't about guessing. It's about thinking, thinking some more, and then thinking, all before you write a single line of code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!