/**
 * 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 stdinScanner = new Scanner( System.in );
	String color;
	System.out.println( "Please enter " + pep.getName() + "'s favorite color: ");
	color = stdinScanner.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.println("How many people do you have to enter: ");
	numPersons = stdinScanner.nextInt();

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

	    getPersonData( person );
	    System.out.println( person.toString() );
	}
    }
}