HW7 Calculate sin(x) or cos(x) using loops and methods with Solution

Retake Due: Wednesday, Nov. 6 10:00am

Do the cosine series as opposed to the sine. Same requirements as the original sine assignment.

Due: Friday, Nov. 1, 2019 11:59pm


Write an application that uses the template that calculates the sin(x).  The sin(x) can be calculated using the following series:

A program consisting of only a main method will not get you a passing grade.  You must break up your logic into as many methods as necessary to solve this problem.  The more methods, the better the grade.

At the very minimum, for each run of the logic, you will prompt the user for x (in degrees).  Remember, the series requires x to be in radians.  (Use Math.PI / 180 as your conversion factor.)  You will also prompt the user for the number of terms to calculate in the series.  You’ll output your series calculation, as well as Math.sin(x), and the difference between the two values to see how close your calculation is.

At the end of your logic, you’ll ask the user if they want to repeat the calculations.

Your grade will be based on the following criteria:

  • how much of the application is finished
  • whether it works
  • if you coded methods
  • the number of methods
  • if you formatted the output values using the printf method (assume just 6 decimal places for the output display)