java – Math. Invalid cos
This point of my program should use the cosine rule to calculate bottomangle
public double bottomAngle() { topAngleinradians = Math.toradians(topAngle) ; return (Math.cos(topAngleinradians)(bottomAngle() = ladderLength^2 + floorLength^2 - verticalHeight^2) / 2 * ladderLength * floorLength) ; }
Error generated:
This is my error list. I can't figure out what's wrong with my formula All methods such as verticalheight and ladderlength work well in other methods I got the formula wrong Can you help me?
Solution
If you do not see the error list, a syntax error occurs:
return(Math.cos(topAngleinradians)(bottomAngle()= ladderLength ^ 2 floorLength ^ 2 – verticalHeight ^ 2)/ 2 * ladderLength * floorLength);
>What do you think of math There is no operator between the call to cos() and the next part of the expression. > It seems that you are also assigning values to function calls, which makes no sense. >^ The operator is not an exponential operator, but a bitwise exclusive or operator You may be looking for math pow().
These are the tops I see It may be helpful to read about Java operators and how they are evaluated