Maxi.java


Below is the syntax highlighted version of Maxi.java.


/***************************************************************************
 *  Compile: javac Maxi.java
 *  Execute: java Maxi 
 *           (expects input from standard input)
 *  Dependencies: StdIn.java, StdOut.java
 *
 * (Exercise 2.1.1)
 **************************************************************************/
public class Maxi {

    // return the maximum of three integers 
    public static __________ max3(_________________________________) {




    }

    // return the maximum of three doubles
    public static __________ max3(_________________________________) {




    }

    public static void main(String[] args) {
        // Input three integers from standard input
        int num1 = StdIn.readInt();
        int num2 = StdIn.readInt();
        int num3 = StdIn.readInt();
        
        // Call the function max3(a, b, c) to find the largest
        int largest = max3(num1, num2, num3);
        
        // make three quotients with largest as the denominator
        double q1 = (double) num1 / largest;
        double q2 = (double) num2 / largest;
        double q3 = (double) num3 / largest;
        
        // print the largest quotient
        // What will this program always print?
        System.out.println(max3(q1, q2, q3));
    }

}