// Marty Stepp, CSE 142, Autumn 2007 // This program shows methods that return values. // public class ReturnExample { public static void main(String[] args) { for (int i = 1; i <= 10; i++) { System.out.println("The area of a circle of radius " + i + " is " + area(i)); } int median = medianOf3(3, 19, 7); System.out.println("The median is " + median); } // Computes and returns the middle value of the three given integers. public static int medianOf3(int a, int b, int c) { int biggest = Math.max(a, Math.max(b, c)); int smallest = Math.min(a, Math.min(b, c)); return a + b + c - biggest - smallest; } // Returns the area of the circle with the given radius. public static double area(double radius) { // return Math.PI * radius * radius; return Math.PI * Math.pow(radius, 2); } }