// *********************************************************
//    Name: Austin Keeley (keeleyat@jmu.edu)
//    Date: January 16, 2005
//    Assignment: #2 (DefaultLiteral.java)
//
// **********************************************************
//    References and Acknowledgements:
//    -Received help from Prof. Adams via e-mail
//
// **********************************************************
//    The purpose of this class is to prove conclusively
//    the default type of a numeric literal (e.g. 123).
//
// **********************************************************

public class DefaultLiteral
{
	// HOW THE DEFAULT TYPE IS PROVED:
	// I wrote 6 overloaded methods for each of the 6 primative
	// numeric data types (int, double, float, byte,
	// long, and short).  Each takes in a different type
	// in their parameter.  I then call one of the
	// methods using the literal (for example, '123') and
	// check the output to see which method was called,
	// proving the type.
	//
	// I proved this with the given values of 123 and 1234.
	// Then, just for fun, I also tried using other types
	// to be sure the appropriate method is being called.

	// main method
	// start of the program
	public static void main(String[] args)
	{
		determineType(123);   // should be an integer
		determineType(1234);  // also should be an integer
		determineType(12345);
		determineType(123456);
		determineType(1234567);
		determineType(12345678);
		determineType(123456789);
		determineType(1234567898);
   /* 	all of the following cause the error message
	      " integer number too large "
	   determineType(12345678987);
		determineType(123456789876);
		determineType(1234567898765);
		determineType(12345678987654);
   */
 		determineType(123L);  // should be a long
		determineType(12.4);  // should be a double
	}

	// determineType method for integers
	public static void determineType(int x)
	{
		System.out.println("The parameter " + x + " was an integer.");
	}

	// determineType method for doubles
	public static void determineType(double x)
	{
		System.out.println("The parameter " + x + " was a double.");
	}

	// determineType method for floats
	public static void determineType(float x)
	{
		System.out.println("The parameter  " + x + " was a float.");
	}

	// determineType method for bytes
	public static void determineType(byte x)
	{
		System.out.println("The parameter " + x + " was a byte.");
	}

	// determineType method for longs
	public static void determineType(long x)
	{
		System.out.println("The paramter " + x + " was a long.");
	}

	// determineType method for shorts
	public static void determineType(short x)
	{
		System.out.println("The parameter " + x + " was a short.");
	}


} // end DefaultLiteral class
