# SUPER SIMPLE QUESTION!!!

• September 2nd, 2010, 02:34 PM
Options
SUPER SIMPLE QUESTION!!!
I just started me java class and im confused about how powers work, such as

Volume of Cylinder = PIE (radius)2(SUPPOSED TO BE SQUARE, NOT 2) *height

how does the above translate to java code? specificly the power of 2, sry im stupid, thx:D
• September 2nd, 2010, 02:53 PM
Brt93yoda
Re: SUPER SIMPLE QUESTION!!!
For exponents you use:
Code java:

`Math.pow(A, B); //A is the original number. B is to what power`
• September 2nd, 2010, 02:59 PM
copeg
Re: SUPER SIMPLE QUESTION!!!
Take a look at the Java Platform SE 6 class. Most notably the pow method.
• September 2nd, 2010, 03:32 PM
helloworld922
Re: SUPER SIMPLE QUESTION!!!
I always write squares out (in my mind this is faster and more accurate, but not by much) :P

Mmm, PIE. It's actually PI, and you can use Math.PI for the floating point representation of this number. Also, in Java you must explicitly spell out everywhere you're performing a multiplication/add/etc.

Code Java:

```double a = 3; double b = 3a; // error double b = 3 a; // error double b = 3 * a; // correct```
• September 2nd, 2010, 08:38 PM
Options
Re: SUPER SIMPLE QUESTION!!!
Volume of Cylinder = PI(radius)2(power 2) * height
Surface Area of Cylinder = 2 PI radius * height

ok so im confused on why my teacher would give me the above as a formulas. at my level of math and java programming the above makes no sense.. i can decipher the top one. but 2 pi radius * height.. umm wtf

so its 2 * pi * radius * height? Why have one multiplication symbol and not the rest?
• September 2nd, 2010, 09:14 PM
Brt93yoda
Re: SUPER SIMPLE QUESTION!!!
Your anwser should look like this

Code java:

```int height = 2; int radius = 3; double volume = Math.PI * (Math.pow(radius, 2) )* height;```
• September 2nd, 2010, 09:16 PM
Options
Re: SUPER SIMPLE QUESTION!!!
It isn't in parenthesis.. look at volume. o well, i got it fiqured out, i think my teachers kind of mean tho. THanks for the help everyone.
• September 2nd, 2010, 09:21 PM
Brt93yoda
Re: SUPER SIMPLE QUESTION!!!
Did you see my above post?