import java.io.IOException; /** * TestIntList is a test class for the class IntList * * Informatik II - FS2009
* Uebungsserie 5, Aufgaben 1-3
* @author Philipp Bolliger
**/ class TestIntList { public static void main( String[] args ) throws Exception{ IntList myFirstList = new IntList(); //create a list with 10 elements for (int i=0; i < 10; i++) { myFirstList.addFirst((int)(Math.random()*200.0)); } //HERE STARTS YOUR PROGRAM //EXERCISE 5.1.d //print myFirstList System.out.println("myFirstList:"); myFirstList.print(); //add the elements 10 and 20 at the end of the list //...add your code here... System.out.println("myFirstList after adding 10 and 20 to the end of " + "the list:"); myFirstList.print(); //remove the first element in the list //...add your code here... //... myFirstList.print(); //remove the last element in the list //...add your code here... //... //EXERCISE 5.2.c //create a random list with 10 elements //and print it //...add your code here... //... //add three random elements at the top of myRandomList //...add your code here... //... //create two "dummy" lists //...add your code here... //... //print the number of IntList instances that exist at this point System.out.println("At this point there exist xxxx IntList instances"); //EXERCISE 5.3.c //create a new random list (10 elements) and sort it //using the method sort() //print both the unsorted and sorted lists //...add your code here... //... //create another random list (10 elements) and //sort it using the method sortSelf() //print both the unsorted and sorted lists //...add your code here... //... } } // end class TextIntList