This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
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
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 792
    
    2

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: 792
    
    2

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: 32599
    
    4
And welcome to the Ranch
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 792
    
    2

Campbell Ritchie wrote:And welcome to the Ranch


Hm, I usually forget that part!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: why my results can't pass the 999 limit?
 
Similar Threads
Java Code Generator
Stacks
Guidelines for 'extenders' of a class
read an expression and solve it...
Very New To Java Question Help Please!