• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to generate Voters ID automatic in netbean gui  RSS feed

 
Adukwu Attanasius
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please I need help. I want my program to be generating auto voters ID in my java program which I used netbean to code.
 
ab singh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use Random class to generate number and there is also requirement of alpha numeric ID they concatenate with string containing character
for more detail use this link Random class
example code
 
Paul Clapham
Sheriff
Posts: 22701
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Random voter ID numbers? That's definitely one possibility, isn't it? However we haven't been told any of the requirements yet so that might not be right. I think it would be better to get the requirements first before trying to write code which satisfies those requirements. Adukwu, how about if you have a look at our FAQ page TellTheDetails (<-- follow that link).
 
Campbell Ritchie
Marshal
Posts: 56220
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

One way to do that is to have an ID variable in the Voter class which is incremented every time an instance is created.
A much robuster solution but harder to implement is to keep details in a database and make the database create IDs.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!