/**
 * COSC 60 Demo
 * Robust command-line parsing, plus randomness.
 * @author Dennis Brylow
 * @version 1.0,  &nbsp; 2008 Nov 10
 */

class Robust
{
	public static void main(String[] args)
	{
		// for (int i = 0; i < args.length; i++)
		// { System.out.println(args[i]); }


		// Error checking.
		if ( args.length != 3)
		{
			System.err.println("Usage: Robust <int> <String> <float>");
			System.exit(-1);
		}

		int x = 0;

		try { x = Integer.parseInt(args[0]); }
		catch (NumberFormatException nfe)
		{
			System.err.println("ERROR: expected number, got \"" + args[0] + "\"");
			// System.err.println(nfe);
			System.exit(-2);
		}

		float f = 0.0f;
		try { f = Float.parseFloat(args[2]); }
		catch (NumberFormatException nfe)
		{
			System.err.println("ERROR: expected float, got \"" + args[2] + "\"");
			System.exit(-3);
		}

		System.out.println("I'm still running!");
		System.out.println("x = " + x);
		System.out.println("f = " + f);

		java.util.Random random = new java.util.Random();
		f = random.nextFloat();

		System.out.println("random f = " + f);


	}
}

