I have not been successful in running this code, it is showing NPE at the part where i add elements to a HashMap. I am also confused about how to generate the Random ID's during runtime. It is my beginner level so please feel free to sort out almost anything. Thanks.
flag = 1 ???
You are writing Java® not C. You have a boolean type which you should use rather than messing around with 0=false and non‑0=true. Also flag is a very poor name for a flag variable; nobody knows what it means.
Why is that Map static? If you don't have a good reason to make something static, then it is a serious mistake.
Where are you using random numbers? The thread asks abut random numbers but I can't see any random numbers anywhere.
I would make your instance variables private unless there is some good reason not to. For example:
Likewise, you should have access modifiers on your methods. I assume that menu() should be public and all the rest should be private.
Line 73, the variable r is never used.
Line 185, it looks like you have recursion that you really don't want. I would find a way to loop back to the top of the method rather than call it again. I'm also seeing that the methods you call from menu() call menu() again at the end. I would probably put a loop in menu() and have the other methods just return. All this will keep your stack memory cleaner.
All things are lawful, but not all things are profitable.
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad: