import java.io.*;

public class ContactMain
{
	// Create a single shared BufferedReader for keyboard input
	private static BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );
		
	public static void main (String [] args) throws IOException
	{
		//prompt the user for an integer
		System.out.print("How many contacts would you like to add?");
		int numContactsToAdd = Integer.parseInt(stdin.readLine());
		
		//initialize a Contact array with a size specified by the user
		Contact [] myContacts = new Contact[numContactsToAdd];
		
		//loop through the array and add new Contacts
		for (int i = 0; i < myContacts.length; i++)
		{
			System.out.print("Please enter a firstname: ");
			String firstname = stdin.readLine();
			System.out.print("Please enter a lastname: ");
			String lastname = stdin.readLine();
			System.out.print("Please enter a phone: ");
			String phone = stdin.readLine();
			
			myContacts[i] = new Contact(firstname, lastname, phone);
		}
		
		//print out the Contact array
		for (int i = 0; i < myContacts.length; i++)
		{
			System.out.println(myContacts[i]);
		}
	}
}

		