File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes why my results can't pass the 999 limit? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "why my results can Watch "why my results can New topic
Author

why my results can't pass the 999 limit?

Or Ben-Moshe
Greenhorn

Joined: Sep 30, 2012
Posts: 4
the problem of this code is that the result won't past the 999 limit.
for example if i put "800 * 5" the result given back is 40 instead of 4000.
what is the problem?
there is the code:

Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

With

if you enter "800" you're just picking '8', so that's the value you are working with. Rather confusing calculator, I must say... And please UseCodeTags.

Edit: Now I see you edited your post and put your code inside code tags.


The quieter you are, the more you are able to hear.
Or Ben-Moshe
Greenhorn

Joined: Sep 30, 2012
Posts: 4
thanks but i figured it out alone a few minutes ago
Or Ben-Moshe
Greenhorn

Joined: Sep 30, 2012
Posts: 4
but still i can't figure out how to do it without converting the string to char
Or Ben-Moshe
Greenhorn

Joined: Sep 30, 2012
Posts: 4
thats all i got this alone here is the working code
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Why not extract value of desired type directly from String? Check the API for valueOf(String s) method (depending on type of the value you want to get from string it might be in Integer, Double, ..., class).

Edit: Avoid comparing Strings with '==' oparator. Use equals() instead.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39396
    
  28
And welcome to the Ranch
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Campbell Ritchie wrote:And welcome to the Ranch


Hm, I usually forget that part!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why my results can't pass the 999 limit?