
/*

	Tom DeDonno page 675

	reads in a string of action items,
	and adds them to a Vector
 */

import java.util.Vector;

public class VectorDemo {

	public static void main( String[] args ) {

		Vector toDoList = new Vector( 10 );

		System.out.println( 
		"Enter items for the list, when prompted." );
		boolean fDone = false;
		String next = null;
		char ans;

		while( ! fDone ) {

			System.out.println( "Input an entry:" );
			next = SavitchIn.readLine( );
			toDoList.addElement( next );
                        System.out.print( "More items for the list?(y/n):");
			ans = SavitchIn.readLineNonwhiteChar();
			if( (ans == 'n') || (ans == 'N') )
				fDone = true;
			}

		System.out.println( "The list contains:" );
		int position;
		int vectorSize = toDoList.size();
		for( position = 0; position < vectorSize ; ++position )
		System.out.println( toDoList.elementAt( position ) );
	} //end main
} //end class
