import java.util.*; import javax.swing.*; public class Lab04Exercise3 { public static void main(String[] args) { //3 random integers, 1 .. 99 Random generator = new Random(); int a = generator.nextInt(99) + 1; int b = generator.nextInt(99) + 1; int c = generator.nextInt(99) + 1; System.out.println( a + " " + b + " " + c ); //**** Calculate the largest input value into max **** //ALGORITHM //Step 1: Assign max with the larger of a and b via a call of maxOf2() //Step 2: Assign max with the larger of c and max via a call of maxOf2() int max = 0; //**** Calculate the smallest input value into min **** //ALGORITHM: Similar to the algorithm to find max, via minOf2() calls int min = 0; //**** Calculate the median input value into med **** int med = a + b + c - min - max; //Display the numbers in ascending order System.out.println( min + " " + med + " " + max ); } //Return the larger of 2 integer values public static int maxOf2(int x, int y) { return y; } //Return the smaller of 2 integer values public static int minOf2(int x, int y) { return y; } }