IntegerList - IntegerList.java Define an IntegerList class with methods to create and fill a list of integers public class IntegerList int

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // **************************************************************** // IntegerList.java // // Define an IntegerList class with methods to create and fill // a list of integers. // // **************************************************************** public class IntegerList { int list; //values in the list int numElements; //number of elements actually in the list //------------------------------------------------------- //create a list of the given size //------------------------------------------------------- public IntegerList(int size) { list = new int[size]; } //------------------------------------------------------- //fill array with integers between 1 and 100, inclusive //------------------------------------------------------- public void randomize() { for (int i=0; i<list.length; i++) list[i] = (int)(Math.random() * 100) + 1; numElements = list.length; } //------------------------------------------------------- //print array elements with indices //-------------------------------------------------------...
View Full Document

This note was uploaded on 03/22/2010 for the course CS 202 taught by Professor Fong during the Spring '10 term at SIU Carbondale.

Page1 / 2

IntegerList - IntegerList.java Define an IntegerList class with methods to create and fill a list of integers public class IntegerList int

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online