import java.util.*;

public class TicketGenerator 
{

	// Java program to print out a museum ticket using
	// a person's name input using a scanner and a code
	// using random numbers.

	public static void main(String[] args)
	{
		// The scanner we create doesn't have to be called scan.
		Scanner keyboardInput = new Scanner(System.in);

		System.out.println("Please enter your first name:");
		String firstName = keyboardInput.nextLine().toUpperCase();
		System.out.println("Please enter your last name:");
		String lastName = keyboardInput.nextLine().toUpperCase();

		// To move to the next line, you can call the println
		// method without arguments, or you can print out the
		// character \n

		System.out.println();
		System.out.println("********************************************");
		System.out.println("  ---- PITTSBURGH MUSEUM ENTRY TICKET ----  ");
		System.out.println();

		System.out.println("  " + firstName + " " + lastName);

		System.out.print("  Ticket Number: ");
		displayFirstNum();
		System.out.print("-" + firstName.charAt(0) + "-");
		displaySecondNum();
		System.out.println("-" + lastName.charAt(lastName.length()-1));

		System.out.print("  Validation Code: ");
		displayValidationCode();

		System.out.print("  Expires:  ");
		displayDate();

		System.out.println("********************************************");
	}

	public static void displayFirstNum() 
	{
		// Displays a random 4-digit integer that doesn't start with 0
		// (i.e. a number in the range {1000, ... , 9999})

		System.out.print((int)(Math.random()*9000) + 1000);
	}

	public static void displaySecondNum()
	{
		// Displays a random 3-digit number consisting only of even digits

		System.out.print((int)(Math.random()*5) * 2);
		System.out.print((int)(Math.random()*5) * 2);
		System.out.print((int)(Math.random()*5) * 2);
	}

	public static void displayValidationCode()
	{
		String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		int index;

		// Pick a random index between 0 and 25 inclusive, three times
		index = (int)(Math.random()*26);
		System.out.print(alphabet.charAt(index));
		index = (int)(Math.random()*26);
		System.out.print(alphabet.charAt(index));
		index = (int)(Math.random()*26);
		System.out.println(alphabet.charAt(index));
	}

	public static void displayDate()
	{
		String months = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";

		// Pick a random month number between 1 and 12 inclusive
		int monthNum = (int)(Math.random()*12) + 1;

		// Print out corresponding month name and last day
		System.out.print(months.substring(monthNum*3-3,monthNum*3) + " ");
		System.out.println("2010");
	}

}
