List - /* * Jesus Campos * CS-116-004 * Final Project -...

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

View Full Document Right Arrow Icon
/** * Jesus Campos * CS-116-004 * Final Project - List Class * The List class is the backbone of this program. The List class creates an array where objects(Structures), * i.e. damaged, condemned, destroyed, regular are going to be stored. This class also provides all methods to * manipulate these objects. i.e. This class will allow you to insert, delete, change position of objects, etc. **/ package code2; p public class List { p final int MAX_SIZE = 100; private Structure [] list; private int index = 0; private int pos; p /** * The default constructor allows us to create an array for size 100. If the size needed to be changed, * there is not need to create a new array, all we need to do is change the MAX_SIZE field above. The overloaded * constructor allows us to create an array of a specific size. */ public List() { list = new Structure[MAX_SIZE]; index = 0; pos = 0; } public List(int newSize) { list = new Structure[newSize]; index = 0; pos = 0; } public int getLength() { return list.length; } /** * there are two insert methods, the first one keeps track of where the last object is positioned. * If we need to insert a new object, it will be inserted in the next
Background image of page 1

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

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

This note was uploaded on 06/18/2009 for the course CS 116 taught by Professor Theys during the Spring '07 term at Central Texas College.

Page1 / 5

List - /* * Jesus Campos * CS-116-004 * Final Project -...

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