illskills
May 22nd, 2010, 08:42 PM
can someone help me convert this 1 line of vb code to java ...
the line below calculates the volume of a bowl in vb (and works)
Dim dvolume As Double = Math.PI * dRadius * dHeight ^ 2 - (Math.PI * dHeight ^ 3) / 3
....
i have tried to add it to my java android project and am not getting the same result ....
using
Double dvolume = Math.pow(Math.PI * dRadius * dHeight, 2) - (Math.pow(Math.PI * dHeight, 3) / 3;
when i use the values 1.5 for the radius and 1 for the height in my vb app i get the result 3.67 m3
when i try the same in java with the above example im getting either 12 or -3 which isnt correct can anyone help pls
the line below calculates the volume of a bowl in vb (and works)
Dim dvolume As Double = Math.PI * dRadius * dHeight ^ 2 - (Math.PI * dHeight ^ 3) / 3
....
i have tried to add it to my java android project and am not getting the same result ....
using
Double dvolume = Math.pow(Math.PI * dRadius * dHeight, 2) - (Math.pow(Math.PI * dHeight, 3) / 3;
when i use the values 1.5 for the radius and 1 for the height in my vb app i get the result 3.67 m3
when i try the same in java with the above example im getting either 12 or -3 which isnt correct can anyone help pls