// ****************************************************************
// Factorials.java
//
// Reads integers from the user and prints the factorial of each.
// 
// Igor Pavlenko          
// ****************************************************************
import java.util.Scanner;

public class Factorials
{
    public static void main(String[] args) throws IllegalArgumentException //////////
    {
	String keepGoing = "y";
	Scanner scan = new Scanner(System.in);

	
	
	
	
	while (keepGoing.equals("y") || keepGoing.equals("Y"))
	    {
	
	try{
	
		System.out.print("Enter an integer: ");
		int val = scan.nextInt();
		
		
		if (val<0) throw new EmptyCollectionException("val0" );////////////////////////
		
		
		
		System.out.println("Factorial(" + val + ") = " 
				   + MathUtils.factorial(val));
		
	   }
	   
	catch(val0 e)/////////////////////////////////
    {
	System.out.println("not a +int")
    } 
		
		System.out.print("Another factorial? (y/n) ");
		keepGoing = scan.next();
	    }
    }
}
