Need help

Hello All,

I wrote this code but the result is always 0.0.

Would someone please tell me what did I do wrong?

public static void main(String[] args) {

System.out.println(area(10,5,90));

}

public static double area(double a, double b, double cd){

double cr;

cr = Math.PI*cd/180;

double ar;

ar= 1/2*a*b*Math.sin(cr);

return ar;

}

}

[413 byte] By [8-Infinite-8a] at [2007-10-2 2:06:32]
# 1
[url= http://forum.java.sun.com/help.jspa?sec=formatting]Code tags.[/url]1/2 is "int" math, i.e. 0.use 1.0/2.0 (or 0.5)
mlka at 2007-7-15 19:47:54 > top of Java-index,Java Essentials,New To Java...
# 2
Also, you could use Math.toRadians( cd ) rather than Math.PI*cd/180
mlka at 2007-7-15 19:47:54 > top of Java-index,Java Essentials,New To Java...
# 3
Thanx alot mlk : )
8-Infinite-8a at 2007-7-15 19:47:54 > top of Java-index,Java Essentials,New To Java...