Lab Assignment 8
CS201, Spring 2004
1. [Lab Manual] p195 - 201. Everything. This exercise will not be graded.
2. [D&D] (5pt) Ex 7.15. Write a Java application instead of an
applet, and use either System.out.print or
JOptionPane.showMessageDialog for output. You don't need to implement
the re-roll button either.
3. [D&D] (5pt) Ex 7.13. Write a Java application instead of an applet, and use JOptionPane.showMessageDialog for output.
4. (5pt) Write a method firstTwo() which takes an integer array
as parameter. This method re-arrange the array elements such that the
largest element is at position 0 and the second largest element is at
position 1. Write an application to test your method. Your application
should include the following code:
int a[] = {3, 5, 10, -1, 2, 7, 6};
printArray( a ); // should print out 3 5 10 -1 2 7 6
firstTwo( a );
printArray( a ); // should print out 10 7 3 -1 2 5 6
We are going to discuss the solutions
on Monday, so please don't forget to bring your
lab manual to the class.