Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

generating a unique bank account

Posted on 2004-04-23
5
Medium Priority
?
395 Views
Last Modified: 2010-03-31
Hello, I am wondering if you can help me with my homework assignment.
I am trying to create a program that runs in bank teller machine.  From this teller if existing customer, you can withdraw, deposit and check balances,  If not, you can become a new customer.  When someone becomes a customer, an account number that identifies this particular cliet is generated.  How can I write a method to generate this account number?   The only information I am requesting from the new client is first name, lastname, telephone, and initial desposit.
Thank you.

 
0
Comment
Question by:j_cisek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10905434
Keep track of last ID generated and just increnment it each time.
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10905440
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 10905442
public class IDGenerator
{
   int Next = 0;

   public IDGenerator(int lastid)
   {
      Next = lastid;
   }

   public int getNextID()
   {
      return ++Next;
   }
}
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 10905454
simply....just put the numbe generated in the vector, during next number generation, check for it in the vector, or else,generate new number....but careful, u may not be sure that u will always generate unique number or it will take more time, since it can generate the same number if some 1000 numbers or more is in the vector and each time it makes a check and lot of resources will be wasted

 ============
S.M.W
0
 
LVL 92

Expert Comment

by:objects
ID: 10905569
:)
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question