 /*****************************************************************
 * Lab 3: ErrorHandler
 * Programmer: Insert your name
 * 
 * Due Date: Insert due date
 * Class: COMP 110-01         Instructor: Tyler Johnson
 *         
 * Pledge: I have neither given nor received unauthorized aid
 * on this program.     (signature on file)
 *
 * Description: This program generates an error and prints the error
 *				code as well as a message describing the error
 *
 * Input: None
 *
 * Output: An error code & message describing the error
 *
 ******************************************************************/

public class ErrorHandler {
	
	enum Error {NULL_POINTER, OUT_OF_MEMORY, DIVIDE_BY_ZERO, OVER_FLOW, UNKNOWN_ERROR}
	
	public static void main(String[] args)  {
			
		Error error;
		
		error = getError();
		
		//YOUR CODE HERE
	}

	public static Error getError()  {
	
		//generate an error and return it
		double d = Math.random()*1000;
				
		int a = (int)d;
		a = a %Error.values().length;
		System.out.println("Error 0x" + (a+1) + "000 enountered!");
		
		return Error.values()[a];
	}
}