• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java SE 6 validating Required data elements

 
duane skey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help Validating the required data elements in this program. I need the Patient id,Patient last name Patient first name, Patient primary care physician, Patient address1,Patient city, Patient State, Patient zip. all validated (entered as non-spaces) If invalid data is ,entered, display an "invalid input of type .. Record reject" message and use the COUNTINUE statement to return to the top of the loop to allow a new entry to be made.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"coach win", please check your private messages for an important administrative matter.
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Use Code Tags. You can edit your post to add them.
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Scanner's other methods, like nextInt(). Also, use the hasNextXXX methods to check if data is available. For instance:
To make sure your code remains readable, you can create one method for each different type of validation.
 
duane skey
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
inserted the code into the program and this is the error
recieved this Error on This line
if (id == null || <id is invalid>);
Multiple markers at this line

- Syntax error on token "is", , expected
- String literal is not properly closed by a
double-quote
- Syntax error on token(s), misplaced construct
(s)
- Syntax error on tokens, delete these tokens
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The <id is invalid> is pseudo code. You should fill that in yourself, based on the logic of when an ID is invalid. As I said, you could create a method "boolean isValidPatientID(String id)", then change the if to
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic