|
Sample midterm questions |
Listed below are questions similar to those I will put on the midterm. Sample solutions will be posted Thursday.
public static double average(double a, double b)
that returns the average of a and b.
public static int minimum(int i, int j)
that returns the smaller of i and j.
public class ExampleProgram { public static void main(String[] args) { int index = 0; int total = 0; int upper = 10; while (index <= upper) { total += index; index++; } System.out.println("The total is " + total); } }