Hi everyone, so I'm still trying to figure out how to get my recursive function to work to calculate my sine so I figured I'd start with a factorial function and work my way up, adding the necessary parts. I looked at http://www.javaprogrammingforums.com...-concepts.html but I can't get any of the code to work.

I get these errors

ftest.java:1: class, interface, or enum expected public static int interativeFactorial(int n) ^ ftest.java:4: class, interface, or enum expected for(int i = 1; i < n; i++) ^ ftest.java:4: class, interface, or enum expected for(int i = 1; i < n; i++) ^ ftest.java:4: class, interface, or enum expected for(int i = 1; i < n; i++) ^ ftest.java:7: class, interface, or enum expected } ^ ftest.java:9: class, interface, or enum expected } ^ 6 errors

All I'm using is

public static int interativeFactorial(int n) { int answer = 1; for(int i = 1; i < n; i++) { answer *= i; } return answer; } }

I've tried adding in

public class ftest { public static int interativeFactorial(int n) { int answer = 1; for(int i = 1; i < n; i++) { answer *= i; } return answer; } }

but then I get the error

Exception in thread "main" java.lang.NoSuchMethodError: main

so then I tried putting in

public class ftest { public static void main(String args[]) { public static int interativeFactorial(int n) { int answer = 1; for(int i = 1; i < n; i++) { answer *= i; } return answer; } } }

then I just get more errors!

ftest.java:5: illegal start of expression public static int interativeFactorial(int n) ^ ftest.java:5: illegal start of expression public static int interativeFactorial(int n) ^ ftest.java:5: ';' expected public static int interativeFactorial(int n) ^ ftest.java:5: '.class' expected public static int interativeFactorial(int n) ^ ftest.java:5: ';' expected public static int interativeFactorial(int n) ^ 5 errors

I'm pretty lost about what to do at this point if I can't even get this to compile and work right. Any clarification would be appreciated!