Computer Science Canada

Double operators

Author:  Homer_simpson [ Fri Feb 13, 2004 11:33 pm ]
Post subject:  Double operators

is there a way to add and subtract doubles?

Author:  Paul [ Fri Feb 13, 2004 11:36 pm ]
Post 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.

Author:  wtd [ Fri Feb 13, 2004 11:38 pm ]
Post 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;
   }
}

Author:  Homer_simpson [ Sat Feb 14, 2004 2:30 am ]
Post subject: 

i mean Doubles not doubles..

Author:  wtd [ Sat Feb 14, 2004 5:06 am ]
Post subject: 

The Sun Java API documentation is your friend.

http://java.sun.com/j2se/1.4.2/docs/api/


: