A good answer might be:

radians


Radians

As is normal for most calculators (and other programming languages), the arguments for Java's trigonometric functions are in radians. Unlike most calculators, you can't push a button and switch to degrees. Here is an example program:

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

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

Here is an example run:

C:\chap11>java CosineCalc
Enter radians:1.5
cosine: 0.0707372016677029

QUESTION 16:

What do you suspect are the types of the argument and return value for Math.cos()?