Error Checking for user input

Reply

Join Date: Sep 2005
Posts: 2
Reputation: guessvic is an unknown quantity at this point 
Solved Threads: 0
guessvic guessvic is offline Offline
Newbie Poster

Error Checking for user input

 
0
  #1
Sep 4th, 2005
Hello all, is that possible to help me out with Error Checking for user input? I am developing a peg solitaire program and now need a error checking for user input or for input file.

Either use try and catch.. or making another method.. can anyone give a me a hint or help me out here please.

Regards
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 57
Reputation: Easter Bunny is an unknown quantity at this point 
Solved Threads: 1
Easter Bunny's Avatar
Easter Bunny Easter Bunny is offline Offline
Junior Poster in Training

Re: Error Checking for user input

 
0
  #2
Sep 5th, 2005
what kind of error checking? like when the user tries to put a king on a 7? you can use a method to check that and if the user is being a moron, then you can display a joptionpane or you can throw one of your own exceptions which will have to be dealt with. something like InvalidMoveException.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Error Checking for user input

 
0
  #3
Sep 5th, 2005
For something like that I would say some if else statements would work. Like:

  1. if (!card slot is already taken)
  2. {
  3. //do something
  4. }
  5. else
  6. {
  7. //do something else
  8. }

Of course it would be cool to experiment making your own exception as EB said.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 2
Reputation: guessvic is an unknown quantity at this point 
Solved Threads: 0
guessvic guessvic is offline Offline
Newbie Poster

Re: Error Checking for user input

 
0
  #4
Sep 6th, 2005
Thanks for all replies. I just got it working with try and catch exception, my problem was I use try {}catch (IOException e) {} instead of just use catch (Exception e) {}

The input only reads: From <row><coloum> To <row1><coloum1>
Exception prevent any invalid input such as "jslkfjsdlkfjlkd".
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC