resolved - Vb to java any help appreciated ... (1 line)
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
Re: Vb to java any help appreciated ... (1 line)
You are reading your VB code differently than the IDE. The IDE reads it like this:
Code:
(Math.PI * dRadius) * (dHeight ^ 2) - (Math.PI * (dHeight ^ 3)) / 3
Java code:
Code:
Double dvolume = Math.PI * dRadius * Math.pow(dHeight, 2) - ((Math.PI * Math.pow(dHeight, 3)) / 3);
Re: Vb to java any help appreciated ... (1 line)
thanks dude im going to try this out now :)
... im new to java (its like learning to walk again lol)
Re: Vb to java any help appreciated ... (1 line)
worked like a dream thanks again dude :)