Labs

In these labs we will use the List interface with implementation classes.

  1. Write a program that uses Math.random() to build a List of 10 integers between 10 and 100 (inclusive) and prints them to the screen.
  2. Choose whichever implementation class you want.
  3. Run it several times to see if you can get 10 and 100.

(Solution: NumbersList.java)

  1. Add a sortAndPrintList method, which takes a List of Integers, sorts them, and prints the results.

  2. Don't try to develop a sort algorithm on your own, rather search the Internet for existing algorithms like bubble sort or insertion sort. If you have time, try multiple sort algorithms and be prepared to discuss the details of each with a partner.

(Solution: SortNumbersList.java)


Prev -- Up