|
-
May 22nd, 2010, 08:42 PM
#1
Thread Starter
Lively Member
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
Last edited by illskills; May 23rd, 2010 at 01:06 PM.
-
May 22nd, 2010, 08:52 PM
#2
Frenzied Member
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);
-
May 22nd, 2010, 09:00 PM
#3
Thread Starter
Lively Member
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)
-
May 22nd, 2010, 09:04 PM
#4
Thread Starter
Lively Member
Re: Vb to java any help appreciated ... (1 line)
worked like a dream thanks again dude
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|