/**
 * Exercises the methods in @see SimplePerson using multiple Scanner objects (which is a BAD IDEA)
 * @author Hyrum D. Carroll
 * @version 0.1 (February 25, 2019)
 */

import java.util.Scanner;

public class SimplePersonDriver{

    /**
     * Request and sets the color for a person (using a separate Scanner object)
     */
    public static void getPersonData( SimplePerson pep, Scanner keyboard){
	//Scanner keyboard = new Scanner( System.in );
	String color;
	System.out.print( "Please enter " + pep.getName() + "'s favorite color: ");
	color = keyboard.next();
	pep.setColor( color );
    }

    /**
     * Creates multiple SimplePerson objects
     */
    public static void main( String[] args ){
	Scanner stdinScanner = new Scanner( System.in );
	int numPersons = 0;
	SimplePerson person;
	String name = "";

	System.out.print("How many people do you have to enter: ");
	numPersons = stdinScanner.nextInt();

        int personI = 0;
        while( personI < numPersons ){
	    System.out.println( "Please enter a name: ");
	    name = stdinScanner.next();
	    person = new SimplePerson( name );
	    System.out.println( person.getName() );

	    getPersonData( person, stdinScanner );
	    System.out.println( person.toString() );
            ++personI;
	}
    }
}