Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

How Di I write this code? (quite an easy program I guess)

Thread view: 
Alamannianus@gmail.com - 24 Jun 2005 23:29 GMT
Until now the class is sweet and dandy. Now I want to implement a
function, so that when the user fills in his emailaddress and password,
the system generates a unique id for this user. How can I implement
such a function? Please help.

######################################

public class user {

   private String email;      //user fills in his email
   private String passwort;   //user choses a password
   private String id;         // HERE AN ID SHOULD BE GENERATED BY THE
SYSTEM

      public user(String emailAddress, String Userpassword) {

          email = emailAddress;
          passwort = Userpassword;

      }

      public void releasedateindtabase () {
         System.out.println(("User with ID: " + id ));
         System.out.println(("and email Address " + email));
         System.out.println(("is registered in the system"));

      }

}

###########################################################

// this "superclass" is the one where all users are stored

import java.util.ArrayList;

public class Database {

   private Arraylist user;

   public Database() {

       user = new Arraylist();

   }

   public void getuser(user theuser) {
       
       user.add(theuser);
   }
   
   
}
Malte - 25 Jun 2005 06:49 GMT
> Until now the class is sweet and dandy. Now I want to implement a
> function, so that when the user fills in his emailaddress and password,
> the system generates a unique id for this user. How can I implement
> such a function? Please help.

If you use a database have it generate a nextval from a sequence
(Oracle) or by some other means. If not, use the long value generated
from a timestamp.

Then there are the results of this Google:

http://www.google.dk/search?biw=1271&hl=da&q=java+generate+unique+number&btnG=Go
ogle-s%C3%B8gning&meta
=
Alamannianus@gmail.com - 25 Jun 2005 10:08 GMT
Thanks for the reply.

I dont want to use a database actually. My problem is how do I do this
exactly (codewise). Do I need to write a new class. How do I get the
connection to the classes I already have?

Malte schrieb:
> > Until now the class is sweet and dandy. Now I want to implement a
> > function, so that when the user fills in his emailaddress and password,
[quoted text clipped - 8 lines]
>
> http://www.google.dk/search?biw=1271&hl=da&q=java+generate+unique+number&btnG=Go
ogle-s%C3%B8gning&meta
=


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.