First of all, make sure your syntax gets a bit of a brushwork. All methods in Java are of the type:
|
Code:
|
method(argtype arg1, argtype arg2....);
//or with no arguments
method(); |
Next, while you can do a lot of things in a single line of code, it can get very illegible and hard to maintain, so I would reccomend slicing up your code into smaller bits and pieces.
|
Code:
|
public class Assignment {
public static double toRadians(double degrees) {
return (double)((Math.PI*2*degrees)/360);
}
public static void main(String[] args) {
double sinargDegs = 187;
double cosargDegs = 122;
double sinarg = toRadians(sinargDegs);
double cosarg = toRadians(cosargDegs);
//rest of code for calculation
}
} |
You have quite a bit of help here, so I think you can go on from this to finishing your task by yourself.
EDIT: Fixed getting PI variable from Math class
EDIT2: Just browsed through Math api, there already is a toRadian() method there.