// *************************************************************
// Name:         Mohamed Aboutabl
// Date:         10/07/2004
// Assignment:   Lab 14: TestNamesV2.java
//
// *************************************************************
// References & Acknowledgements: I received no outside help
//
// *************************************************************
// Name of the class:	TestNamesV2
// Purpose of the class: Test the Name class
// *************************************************************

import cs1.Keyboard ;

public class TestNamesV2
{
	/**----------------------------------------------------------
	// Test drive the Name class and its member methods
	// --------------------------------------------------------*/
	public static void main( String[] args)
	{
		// Variables Declarations

		Name name1 , name2 ;	// Objects for the two names
		String last1 , n1 , n2;
		boolean sameName ;
					
		// Get the first person's name from the user
		System.out.println("Enter the following for the first person:");	
		// name1 = inputName() ;
		
		name1 = Name.inputName() ;

		// Get the second person's name from the user
		System.out.println("\nNow, enter the following for the second person:");		
		// name2 = inputName();
		
		name2 = Name.inputName() ;
		
		// Print the two Name objects via the toString method
		System.out.print("You entered:\n\t");
		System.out.println( name1 ) ;
		System.out.print("and:\n\t");
		System.out.println( name2 ) ;	
		System.out.println();
		
		// Now display the two names in the required format
		System.out.println("\nThe First person's data is:");
		// displayName( name1 ) ;
		
		name1.displayName() ;

		
		System.out.println("\nThe Second person's data is:");
		// displayName( name2 ) ;	
		
		name2.displayName() ;
		
		// Check if the two names are identical
		n1 = name1.firstMiddleLast() ;
		n2 = name2.firstMiddleLast() ;
		sameName = n1.equalsIgnoreCase(n2) ;
		
		System.out.println("\nAre the names '" + n1 + "' and '" + n2 
			+ "' the same? " + sameName) ;
			
		// Change the first person's last name
		System.out.print("\nEnter the first person's NEW last name: ");
		last1 = Keyboard.readString() ;
		System.out.println( "Before change " + name1 ) ;
		name1.changeLast( last1 ) ;
		System.out.println( "After  change " + name1 ) ;		
						
	}
	
}