SAT.java


Below is the syntax highlighted version of SAT.java from §2.6 Functions.


/*************************************************************************
 *  Compilation:  javac SAT.java MyMath.java
 *  Execution:    java SAT
 *  
 *  Computes the fraction of students that score less than 820 on their
 *  SAT exam, given that the average score is 1019 and the standard deviation
 *  is 209.
 *
 *  Answer = roughly 17%.
 *
 *  % java SAT
 *  0.17050967431793962
 *
 *************************************************************************/


public class SAT {

    public static void main(String args[]) {
        double mu    = 1019;
        double sigma =  209;
        double z     =  820;
        System.out.println(MyMath.Phi(z, mu, sigma));
        System.out.println(MyMath.Phi(1437, mu, sigma));
    }
}


Last updated: Sat Sep 25 14:36:23 EDT 2004 .
Copyright © 2004, Robert Sedgewick and Kevin Wayne.