A good answer might be:

Of course! Its that simple formula that you memorized in high school (and remembered for about five minutes).

Fun and Simple Trig!

Actually the formula is not that bad:

radians = (Math.PI/180.0)*degrees;

Since this is so commonly done, the Java Math class has convenient methods to do it and the opposite:

public static double toRadians(double angdeg)
    Converts an angle measured in degrees to the equivalent in radians
    
public static double toDegrees(double angrad)
    Converts an angle measured in radians to the equivalent in degrees.

Here is our sample program:

import java.io.*;
class CosineCalc
{
  public static void main (String[] args) throws IOException 
  {
    String charData;
    double degrees;

    // read in a double
    BufferedReader stdin = new BufferedReader 
        (new InputStreamReader(System.in));
    System.out.print  ("Enter degrees:");
    charData = stdin.readLine();
    degrees  = Double.parseDouble( charData  ) ;
    
    // calculate its cosine
    double result = Math.cos( _______________ );
    
    // write out the result
    System.out.println("cosine: " + result );
  }
}

QUESTION 18:

Fill in the blank so that the program works.