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

Username:   Password: 
 RegisterRegister   
 Double operators
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Fri Feb 13, 2004 11:33 pm   Post subject: Double operators

is there a way to add and subtract doubles?
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Fri Feb 13, 2004 11:36 pm   Post subject: (No subject)

double IS a kind of variable right? I dunno, cause thats the only way I've seen it. So, I hope Im not making a fool of myself here, but don't you just use JOptionPane.showInputDialog, take strings, put them in variables, then use Double.parseDouble, and put them strings into new variables, and subtract them? or add them? I dunno... if you wanted to user input the doubles, you could use it.
wtd




PostPosted: Fri Feb 13, 2004 11:38 pm   Post subject: (No subject)

code:
import java.lang.*;
import java.io.*;

class TestDoubleOps
{
   public static void main(String[] args)
   {
      double d = 7.2;
      d = d - 2.5;
      d = d + 3.4;
   }
}
Homer_simpson




PostPosted: Sat Feb 14, 2004 2:30 am   Post subject: (No subject)

i mean Doubles not doubles..
wtd




PostPosted: Sat Feb 14, 2004 5:06 am   Post subject: (No subject)

The Sun Java API documentation is your friend.

http://java.sun.com/j2se/1.4.2/docs/api/
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  [ 5 Posts ]
Jump to:   


Style:  
Search: