home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-12-14 | 1.0 KB | 36 lines |
- import java.util.*;
-
- public class WarningLetterList
- {
- public static void main(String args[])
- {
- // Create the lists of failing students
- String[] French = {"Amy", "Jose", "Jeremy", "Alice", "Patrick"};
-
- String[] Algebra = {"Alan", "Amy", "Jeremy", "Helen", "Alexi"};
-
- String[] History = {"Adel", "Aaron", "Amy", "James", "Alice"};
-
- // Create the set to hold the failing students
- List LettersHome = new ArrayList();
-
- //Add the failing students from each class to the set
- for (int i=0; i< French.length; i++)
- LettersHome.add(French[i]);
-
- for (int j=0; j< Algebra.length; j++)
- LettersHome.add(Algebra[j]);
-
- for (int k=0; k< History.length; k++)
- LettersHome.add(History[k]);
-
- Collections.sort(LettersHome);
-
- //Print out the number of letters to be sent
- // and the recipient list
- System.out.println(LettersHome.size()+" letters must be sent to: "+LettersHome);
-
- }//Main
- }//Warning Letters
-
-