I've been having issues with trying to get this program to work. The program's purpose is to compute the sine function without using the Math.sin(). At first I had trouble with the for loop but I finally understood how it worked, so it's not much of an issue anymore. My next problem is trying to get this factorial to work. I've look at tutorials and I think I'm doing the right thing but when I compile I get several errors (stated in code).
Original Code
/* This program is suppose to compute the Sine function without using Math.sin */ import java.io.*; public class x { public static void main(String args[]) throws IOException { BufferedReader keybd = new BufferedReader(new InputStreamReader(System.in)); double Rad, Sine; int MaxE; Sine = 0.0; System.out.println("Enter Radians: "); Rad = Double.parseDouble(keybd.readLine()); for (int a = 1; a <= 11; a++) { Sine += Math.pow(-1,a)*Math.pow(Rad,2*a+1)/factorial(2*a+1); } System.out.println("The value of Sine is " + Sine); } }
Errors
I think I'm on the right track but I'm not sure how to troubleshoot these errors yet since I'm still pretty new. Any help is appreciated!