I am trying to implement the rint() method, but I am baffled. Here is a sample of my (simplified) code:
public void drawVector(Graphics g){
double theta, xarg;
int x;
xarg = Math.cos(theta);
x = Math.rint(xarg);
and so on.
When I compile, it complains about the argument of rint():
_____________________
found double:
required int:
x = Math.rint(xarg);
^
1 error
_____________________
This makes no sense. According to
Java, rint() is supposed to take a double argument, but the compiler is saying that xarg must be an integer. Why on Earth would rint() take an integer argument when its sole purpose is to convert a double into an integer?
So what mistake am I making?
BTW, which forum category should this question belong? I couldn't find one specifically for general programming errors.