When you post code, don't double-click the code button. Make sure your source code is in between a [code] start tag and [/code] end tag. I've fixed your post for you.
About your problem: How do you know "it is not adding"? Does your code compile? Does it run? Do you get any error messages? Does the program do something else than you expected? If so, then what did you expect exactly, and how does the actual output differ from that?
Note that you are using token multiple times in line 22. Are you sure that is correct? It's the same string that you are passing to the constructor multiple times. I think you meant to read multiple different tokens from the scanner and pass those for the individual parameters for the constructor.
By the way, why is it that Karthik surya posted the original question, and Divya Kotamraju answers? Are you one person with two accounts? (Oh, now you've edited your answer as if you're someone else???)
Joined: Oct 07, 2010
No I am not the same person as Karthik. Even I am doing similar kind of assignment. So I have posted as a reply to this particular post.
Joined: Jan 28, 2011
No. and regarding this question it is giving me number format exception. I think token contains the next value of the scanned i/p. So I have used it.