Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Converting a string to a double
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Token




PostPosted: Thu May 04, 2006 9:53 am   Post subject: Converting a string to a double

I am trying to make a calculator program with GUI and stuff and i have all my keys working but all i need is to do the calculations part. when you press a number or the decimal key it adds the number or decimal to the end of a String, like a calculator does. but in order to do the calculation I'll need to convert this String to a Double, and i cant do that with
code:
Double.parseDouble(string)

because i'm using RTP. please help

thanks

-Jordan
Sponsor
Sponsor
Sponsor
sponsor
HellblazerX




PostPosted: Thu May 04, 2006 10:05 am   Post subject: (No subject)

I used the same command in RTP, and it worked perfectly fine for me. Perhaps you forgot to assign that value to something, like this:

code:
double = Double.parseDouble (string);


What version of RTP are you using?
Token




PostPosted: Thu May 04, 2006 7:32 pm   Post subject: (No subject)

Version 1.0.6

Yah, Assigned it to a variable, but it didnt work, i couldent find it in the double class in my help file so i'm guessing its not with my version.

so no one can think of any other commands?
wtd




PostPosted: Thu May 04, 2006 7:48 pm   Post subject: (No subject)

Don't use RTP. Download the JDK from Sun and there won't be any question about your environment being borked.
codemage




PostPosted: Fri May 05, 2006 8:54 am   Post subject: (No subject)

If it's being graded in school, it'll be by a teacher with the same crummy version of RTP.

It's bizarre that your version is so old though. Current ver is 1.7 - and it's not exactly new.
Token




PostPosted: Sat May 06, 2006 11:08 pm   Post subject: (No subject)

code:
Double.valueOf (double d).doubleValue ()


tada! all thanks to http://javaboutique.internet.com I looked at a copy of a calculator program they made and found that little tidbit of greatness. Thanks for your help, and heres my (semi finnished) applet.



Calc-Tastic!.zip
 Description:
sweetness in calculator form :D

Download
 Filename:  Calc-Tastic!.zip
 Filesize:  3.03 KB
 Downloaded:  79 Time(s)

Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: