• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need HELP with runtime error  RSS feed

 
Sean Magee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my code for a payroll, may be messy, but remember, I am new at this


Now java compiles it, no problem there, however when I run the program I am having problems with string "work". I first tried parsing work as a double, and declaring hours ad difference as a double, doesnt work. I am pretty sure the error has to do with declaring int's and double's in the wrong manner, but of course, I may be wrong. Any suggestions?


[ September 10, 2004: Message edited by: Sean Magee ]

[ edited to format code -ds ]
[ September 10, 2004: Message edited by: Dirk Schreckmann ]
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean,

OK, the problem is on this line...



you are trying to parse the string " How Many Hours Have You Worked This Week?" into an int, which is obviously not going to work because it doesn't make any sense. What you need to do is pick up the text the user enters in the dialog box, and then try to parse that string like this...



does this make sense to you? You are almost using the JOptionPane stuff correctly, but you are just ignoring the value that it returns when the user types something in.
 
Sean Magee
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Ben for your help!

I could also do this, Right?



[ September 10, 2004: Message edited by: Sean Magee ]
[ September 10, 2004: Message edited by: Sean Magee ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!