• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to generate Voters ID automatic in netbean gui

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28271
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Marshal
Posts: 79508
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic