package {
	public class Greeter {
		/*public function sayHello():String {
			var greeting:String;
			greeting = "Hello World!";
			return greeting;
		}*/
		
		public static var validNames:Array = ["Sammy", "Frank", "Dean"];
		public function sayHello(userName:String = ""):String  {
			var greeting:String;
			if (userName == "")  {
				greeting = "Hello. Please type your user name, and then press "
				+ "the Enter key.";
			} 
			else if (validName(userName)) {
				greeting = "Hello, " + userName + ".";
			} 
			else {
				greeting = "Sorry " + userName + ", you are not on the list.";
			}
			return greeting;
		}
		public static function validName(inputName:String = ""):Boolean {
			if (validNames.indexOf(inputName) > -1) {
				return true;
			}
			else {
				return false;
			}
		}
	}
}
