Im having trouble with this problem:

The Maclaurin series for arctan(x) is a formula which allows us to compute an approximation to arctan(x) as a polynomial in x. The formula is:

arctan(x) = x - x3/3 + x5/5 - x7/7 + x9/9 - x11/11 + . . .

Write a method called calculateArctan in the class Mymath . The method reads in a double x, and a positive integer k, and prints out the partial sum from the first k terms in this series. Write a main method to test the method calculateArctan.

Sample output

Enter x:
0.5
Enter integer k:
3
The partial sum from the first k terms: 0.4645833333333333

The arctan of 0.5 : 0.4636476090008061

Its due on monday so I need help quick!

You need t o implement a for loop. I assume that you have been taught how to calculate the sum using a for loop.
This is the same thing to you will need to change the firmula:

sum = 1 + 2 + 3 + 4 + ....

double sum = 0;
for (int i=1;i<N;i++) {
   sum = sum + i;
}