Task: a program that calls Math.cos and myCos twice, once passing Math.PI another passing Math.PI/6.0
myCos should compute and return the value of
1.0 - x^2/(2!) + x^4/(4!) - x^6/(6!) + ... + x^96/(96!) - x^98/(98!)
import java.util.Scanner; class Cos { double x; double sum = 0.0; double count= 2.0; double term= 1.0; double sign = 1.0; Scanner kb = new Scanner(System.in); System.out.println("Enter number of term to sum:"); while (count <= 98) { sum = sum + sign* 1.0/term; sign = -sign; sum= count*(count-1)*sum; term = term*x*x; count ++; double y= Math.pow(X4); } System.out.println("Math.cos =" +Math.cos); System.out.println("myCos=" +sum) }